Template not seeming to instantiate a second time with default alias parameter

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 30 14:57:12 PDT 2016


On 08/30/2016 11:28 PM, wobbles wrote:
> I'll have to try find a workaround for now :/

This also seems to work, but has a slightly different meaning:

----
class Node(T, alias func = t => t*t) {/* ... */}
----

The default func is a template here. Equivalent to this:

----
auto square(T)(T t) { return t*t; }
class Node(T, alias func = square) {/* ... */}
----



More information about the Digitalmars-d-learn mailing list