Templates array detection

Cube sq at ua.re
Wed Dec 12 07:37:08 PST 2012


On Wednesday, 12 December 2012 at 15:21:16 UTC, Ali Çehreli wrote:
> On 12/12/2012 06:49 AM, Cube wrote:
> > Better example code for my other problem. How can I make the
> 3rd foo
> > work on Datas?
> >
> > --
> > struct Data(T)
> > {
> > T elem;
> > }
>
> Data is a struct template, not a type (until instantiated).
>
> > void foo(T)(T t) if(is(T == Data)) // ?
>
> This works:
>
> void foo(T)(T t) if(is(T == Data!T))

It doesn't seem to work for me, it uses the first foo. And I 
can't see how it would work, actually.
If T is a Data!float, then wouldn't
is(T == Data!T)
be equal to
is(Data!float == Data!Data!float)
?

>
> Ali



More information about the Digitalmars-d-learn mailing list