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

2016-08-31 Thread wobbles via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 21:35:29 UTC, ag0aep6g wrote: On 08/30/2016 11:28 PM, wobbles wrote: I'll have to try find a workaround for now :/ This seems to work and isn't too ugly: class Node(T, alias func) {/*...*/} alias Node(T) = Node!(T, (T t) => t*t); Excellent - thanks

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

2016-08-30 Thread ag0aep6g via Digitalmars-d-learn
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) {

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

2016-08-30 Thread ag0aep6g via Digitalmars-d-learn
On 08/30/2016 11:28 PM, wobbles wrote: I'll have to try find a workaround for now :/ This seems to work and isn't too ugly: class Node(T, alias func) {/*...*/} alias Node(T) = Node!(T, (T t) => t*t);

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

2016-08-30 Thread wobbles via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 20:55:20 UTC, ag0aep6g wrote: On 08/30/2016 10:41 PM, wobbles wrote: class Node(T, alias func = (T t => t*t))(){ //whatever } //instantiate Node!(int) intNode; Node!(float) floatNode; // fails as lambda func expects an int. Am I doing something wrong or is

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

2016-08-30 Thread ag0aep6g via Digitalmars-d-learn
On 08/30/2016 10:41 PM, wobbles wrote: class Node(T, alias func = (T t => t*t))(){ //whatever } //instantiate Node!(int) intNode; Node!(float) floatNode; // fails as lambda func expects an int. Am I doing something wrong or is this a bug? Proper test case: class Node(T, alias func =

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

2016-08-30 Thread wobbles via Digitalmars-d-learn
Hi, Code here: https://gist.github.com/grogancolin/066a8a8c105fa473dfee961e2481a30e Basically, it seems when a template has an alias parameter like class Node(T, alias func = (T t => t*t))(){ //whatever } //instantiate Node!(int) intNode; Node!(float) floatNode; // fails as lambda func