The title isn't very clear but I wasn't sure how to phrase it without code. Basically what I want to do is this (won't compile):

struct Foo(int N) {
}

void func(T)(T obj) if(is(T:Foo)) {
}

void func(T)(T obj) if(!is(T:Foo)) {
}

Foo by itself isn't a type, but I don't want to limit func instantiation in the 1st case to just e.g. Foo!3 but to _any_ Foo regardless of N. I came up with two workarouds: make Foo a class that derives from an empty FooBase (then is(T:FooBase) works), or adding a "secret" enum within Foo that I can check with std.traits.hasMember in a static if. I don't really like either of them. Is what I want to do possible?

Atila

Reply via email to