Re: template auto deduction

2017-10-06 Thread Alex via Digitalmars-d-learn
On Friday, 6 October 2017 at 21:42:40 UTC, Steven Schveighoffer wrote: What you need is IFTI or "Implicit Function Template Instantiation" Note the "Function" part of it, in that it's only valid for functions. So you need a factory function: auto m(T)(T x) { return M!(T)(x); } ...

Re: template auto deduction

2017-10-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/6/17 5:08 PM, Alex wrote: Hey, template gurus :) given this: struct M(alias I : S!E, alias S, E...) { R!E r; this(S)(S initStruct)    // line 4 {     r = R!E(initStruct); } } struct R(E...) { this(S)(S initStruct)    // line 12 {     // do some

template auto deduction

2017-10-06 Thread Alex via Digitalmars-d-learn
Hey, template gurus :) given this: struct M(alias I : S!E, alias S, E...) { R!E r; this(S)(S initStruct)// line 4 { r = R!E(initStruct); } } struct R(E...) { this(S)(S initStruct)// line 12 { // do some cool