Template-Parameterized Variadic isInstaceOf

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 7 05:58:30 PDT 2015


On Friday, 7 August 2015 at 11:45:22 UTC, Nordlöw wrote:
> To implement a new trait
>
>     isSortedRange(R, pred)
>
> needed for SortedRange specializations I need a variant of
>
>     enum bool isInstanceOf(alias S, T) = is(T == S!Args, 
> Args...);
>
> that takes the `pred` argument aswell.
>
> But I have no clue what to do with
>
>     enum bool isInstanceOf(alias S, T, TParams) = is(T == 
> S!Args, Args...);
>
> because I dont' understand the syntax
>
>     is(T == S!Args, Args...);
>
> Can somebody please explain and help out with variadic version 
> of `isInstanceOf`?

I believe that it is read as "T is equal to the template 
instansiation of S for some args Args...

Similar to the more common (T ==V[K],V,K) read as " an 
associative array with V as the value, K as the key for some V 
and some K"

Used to get the instansiation parameters.


More information about the Digitalmars-d-learn mailing list