On Tue, 31 May 2011 19:49:24 +0200, Steven Schveighoffer
<[email protected]> wrote:
Currently, you can omit the template args only in the case of IFTI
(Implicit Function Template Instantiation) which actually deduces your
template arguments based on the function call.
I'd argue actually, that IFTI should be extended to constructors:
class Test(T)
{
this(T t) {}
}
T t;
auto a = new Test(1);
static assert(is(typeof(a) == Test!int));
Which would also cover your case.
This should be a no-brainer since a constructor call is almost identical
in nature to a function call. For sure the overload resolution is the
same.
I thought there was a bugzilla entry for this, but I couldn't find it
with some simple searches, anyone know of one? If not, I'll file one.
I've filed one at some point. Actually, looking at it, this was for static
opCall for structs. The idea is still the same, though.
http://d.puremagic.com/issues/show_bug.cgi?id=1997
--
Simen