www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Partial Specialization using Static If

 But you can say this:

 static if (is(T U == U*))

 U is then declared to be an alias of the type T is a pointer to (and it
 only exists within the static if's scope).

 Assuming T is int*, you get

 static if (is(int* U == int*))
      static assert(is(U == int));

 This works more generally, too:

 static if (is(T U == U[]))

 That determines if T is a dynamic array, and U becomes an alias for the
 type of an element of the array.

Thanks, I didn't know you can do that.
Dec 24 2006