On Mon, 25 Mar 2013 11:11:40 -0400, Sergei Nosov <sergei.no...@gmail.com>
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?

There really isn't.  I have created an enhancement request that you might
be interested in voting for.

http://d.puremagic.com/issues/show_bug.cgi?id=6082

Note that auto is your friend here to avoid the dual-specification of the template:

auto hello = test!int(cptr);

And you can always create a wrapper function:

test!T mktest(T)(T *ptr) { return test!T(ptr);}

...

auto hello = mktest(cptr); // no explicit instantiation required

-Steve

Reply via email to