Typeless identifiers in templates

BCS BCS_member at pathlink.com
Sat Apr 22 18:02:26 PDT 2006


I am considering a template project that will require a template to specialize
on an identifier that has no other meaning, I would like to do something like
this:

template foo(alias ID1, alias ID2)
{
const int foo = bar!(ID1) + bar!(ID2);
}

template bar(alias ID : A){  const int bar = 1;  }
template bar(alias ID : B){  const int bar = 2;  }

void fn()
{
int i = foo!(A,B); // resolves to 3
}

what type should A, B, etc. be? Really all they are is compile time names. What
would be nice is a "template name" type of some sort. Any ideas for a better
solution?





More information about the Digitalmars-d-learn mailing list