Verify tuple is a tuple of class objects?
Sean Eskapp
eatingstaples at gmail.com
Fri Feb 18 13:15:16 PST 2011
Is there a way to "run" a template at compile time, without using a member?
What I'm trying to do is verify that every element of a tuple is a class type,
and so far, I've been doing this:
template VerifyTuple(Type, Types...)
{
static assert(is(Type : Object), Type.stringof ~ " is not a class type.");
static if(Types.length == 0)
alias void dummy;
else
alias VerifyTuple!(Types).dummy dummy;
}
and to use it, I have to do this:
class Foo(T...)
{
alias VerifyTuple!(T).dummy dummy;
}
Is there any way to just "run" the template, without bothering to use the
dummy aliases?
More information about the Digitalmars-d-learn
mailing list