is pointer

Daniel Keep daniel.keep.lists at gmail.com
Fri Mar 19 19:48:18 PDT 2010


bearophile wrote:
> (I am looking for rough corners in D, or in my knowledge of D.)
> 
> In this page:
> http://www.digitalmars.com/d/2.0/templates-revisited.html
> 
> In the section "Template Parameters" there is written:
> 
> P:P*,         // P must be a pointer type
> 
> -----------------
> 
> So I have written this D2 program:
> 
> 
> template IsPointer1(T) {
>     enum bool IsPointer1 = is(T : T*);
> }
> void main() {
>     int* ptr;
>     static assert(IsPointer1!(typeof(ptr))); // Err
> }
> 
> 
> But it asserts, do you know why?

You do realise that "Template Parameters" are a completely different
thing to "is expressions", right?


More information about the Digitalmars-d-learn mailing list