Help!
Manu
turkeyman at gmail.com
Mon Nov 26 08:36:59 PST 2012
template isThing( alias symbol, A )
{
enum isThing = false;
}
This template works in most contexts:
int x;
struct S {}
pragma(msg, isThing!x);
pragma(msg, isThing!S);
But this fails:
pragma(msg, isThing!int);
Why does it fail on a basic type (int), but not a user defined type (S)?
How can I fix the template declaration to not error in that case?
I tried:
template isThing( alias symbol, A )
{
enum isThing = false;
}
template isThing( T, A )
{
enum isThing = false;
}
Hoping the T version would catch the int, but this leads to different
errors "matches more than one template declaration".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121126/013e7849/attachment.html>
More information about the Digitalmars-d
mailing list