how to call class' template constructor
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 12 12:46:32 PDT 2014
Hello.
please, how to call template constructor of a class? it's completely
escaped my mind. i.e. i have this class:
class A {
this(alias ent) (string name) {
...
}
}
and i want to do:
void foo () { ... }
auto a = new A!foo("xFn");
yet compiler tells me that
"template instance A!foo A is not a template declaration, it is a class"
yes, i know that i can rewrite constructor to something like this:
this(T) (string name, T fn) if (isCallable!T) {
...
}
and then use autodeduction, but i want the first form! ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141012/9104db30/attachment.sig>
More information about the Digitalmars-d-learn
mailing list