The is expression

Philippe Sigaud philippe.sigaud at gmail.com
Tue Apr 5 11:13:37 PDT 2011


> thanks for your answer. If it is that complicated if I prefer explicit
> specialization, I think. But I do not quite understand that it is not
> possible to achieve this with a simple "is" expression (without a
> function like "isAnA" and using "__traits") as the D language reference
> includes a very similiar example based on arrays:
>
>
>  static if (is(int[10] W : W[V], int V))
>
> what is the essential difference to:
>
>    static if( is( A!(int, "xxx") T == A!(T, s), string s ) )

I don't know. Maybe the compiler knows about arrays and associated
arrays, whereas it isn't smart enough to extract the correct
information from a templated type? The is() expression was not
developed from first principles: it grew 'organically' as a
hodge-podge of tricks and needs.


More information about the Digitalmars-d-learn mailing list