On 24/08/2012 17:27, Nick Treleaven wrote:
On 24/08/2012 06:14, F i L wrote:
It's a similar story with __traits(). What appears to be a function
taking in a run-time parameter is actually compile-time parameter which
works by "magic". It should look like:
bool b = traits!HasMember(Foo);
Correcting myself:
bool b = traits.hasMember!(Foo, "bar");
int i;
bool b = traits.isArithmetic!i;
'i' cannot be a compile-time parameter or a runtime parameter either (by
normal rules).
I realized I was wrong here, 'i' can be a template alias parameter.
So I think __traits are special, they're not really like
a template function.
But most seem close in semantics to a template instantiation, so that
syntax might be nice.