Extracting template parameters
Tobias Pankrath
lists at pankrath.net
Tue Nov 6 07:40:08 PST 2012
On 11/06/2012 04:25 PM, Joseph Rushton Wakeling wrote:
Look at the is() expression in the language spec.
I didn't get it to work with a template constraint, because the pattern
matched parameter are out of scope in the function body.
----
struct A(T1, T2)
{
}
struct B(B1, B2) {}
void foo(T)(T x)
{
static if(is(T Dummy : A!(P), P...))
{
pragma(msg, P);
}
}
void main() {
A!(int, float) a;
foo(a);
}
More information about the Digitalmars-d-learn
mailing list