is pointer
bearophile
bearophileHUGS at lycos.com
Sat Mar 20 04:56:32 PDT 2010
Daniel Keep:
> You do realise that "Template Parameters" are a completely different
> thing to "is expressions", right?
Nope. And from the other answers by Moritz and Ellery it seems I am not alone :-)
You are right, this works:
template IsPointer1(T:T*) {
enum bool IsPointer1 = true;
}
template IsPointer1(T) {
enum bool IsPointer1 = false;
}
void main() {
static assert(IsPointer1!(int*));
static assert(!IsPointer1!(int));
static assert(!IsPointer1!(int[]));
}
This syntax looks too much similar to the syntax with is():
template IsPointer1(T:T*) {
It's a syntax collision. You realize that I will not be the only one to fall in this little trap.
Bye and thank you,
bearophile
More information about the Digitalmars-d-learn
mailing list