Possible bug

Ali Çehreli acehreli at yahoo.com
Mon Mar 25 08:31:17 PDT 2013


On 03/25/2013 08:11 AM, Sergei Nosov wrote:
 > On Monday, 25 March 2013 at 14:12:17 UTC, bearophile wrote:
 >> Sergei Nosov:
 >>
 >>> Everything's fine if I specify parameters explicitly:
 >>> <pre>
 >>> test!int hello = test!int(cptr);
 >>> </pre>
 >>
 >> Some persons have proposed alternative designs, but D is working as
 >> currently designed here... Unlike template functions, templated
 >> structs don't infer the type.
 >>
 >> Bye,
 >> bearophile
 >
 > Thx, is there any good rationale?

This design allows templated constructors:

struct S         // <-- not a template
{
     this(T)(T t) // <-- template
     {
         // ...
     }

     // ...
}

The same in C++...

Ali



More information about the Digitalmars-d-learn mailing list