[Issue 3608] Allow isExpression and templates to capture template parameters and FQN of template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 8 07:01:18 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3608
--- Comment #3 from Simen Kjaeraas <simen.kjaras at gmail.com> 2010-11-08 07:00:15 PST ---
I'm not sure what it is that confuses you. D allows constraints to be placed on
template parameters not only by means of template constraints, but also
isExpression-like patterns in the parameter list:
class A {}
class B : A {}
template isAnA( T : A ) {
enum isAnA = true;
}
static assert( isAnA!B );
This also works for more complex type constraints:
template extractTupleArgs( T == Tuple!U, U... ) {
alias U extractTupleArgs;
}
static assert( is( extractTupleArgs!( Tuple!int ) == int ) );
It does however not work for complex type constraints where the template is not
known:
template dissectTemplate( T == U!V, V... ) {
alias U tmpl;
alias V args;
}
And it is this last case I want covered.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list