On Fri, Dec 6, 2013 at 5:31 AM, Uranuz <[email protected]> wrote:
> As far as I understand TemplateParamList in *is* expr should work just like
> it works in usual template. So this problem is just lack of implementation.
> I'll try to find workaround with * is( N == Nullable!(T), T ... ) * syntax.
>
> Thank you for response.

Once you are 'inside' a static if guarded by an is() expression, the
symbols you introduced inside the is() are visible, so you can test
T... further if you want. In my proposal, nV is visible right after
the is(), so here is a more correct expression:

import std.stdio, std.typecons;

template isStdNullable(N)
{
        static if(
                is( N == Nullable!(T), T )
                || is( N == NullableRef!(T), T )
                || is( N == Nullable!(T, nV), T, alias nV ) &&
is(typeof(nV) == T) // <-- There
        )
                enum bool isStdNullable = true;
        else
                enum bool isStdNullable = false;
}


void main()
{
        writeln(isStdNullable!(Nullable!(int, 10)));
}

Reply via email to