On Wednesday, 15 June 2016 at 03:45:39 UTC, Walter Bright wrote:
On 6/14/2016 8:23 PM, tsbockman wrote:
This is specified fully in the template constraints:
    if (isIntegral!N && isUnqual!N)
    if ((isIntegral!N && !isUnqual!N) || isCheckedint!N)

The second overload simply forwards to the first, after applying
BasicScalar!(Unqual!N).

Why would a checkedint be a base type for a checkedint?

Generic code (contrived, oversimplified example):

    import checkedint.throws, checkedint.traits;

SmartInt!(typeof(A.init + B.init)) add(A, B)(const A a, const B b)
        if (isIntegral!A && isIntegral!B)
    {
        SmartInt!A ma = a;
        SmartInt!B mb = b;

        return ma + mb;
    }

Of course I could force the user to write `BasicScalar` everywhere - but why? The intent is just as clear this way, and it's less verbose.

Reply via email to