Let this() figure out T implicitly?
kraybourne
stdin at kraybourne.com
Fri Feb 17 05:02:21 PST 2012
On 2/17/12 1:32 PM, bearophile wrote:
> kraybourne:
>
>> Then it compiles. Is it possible to have this() figure out the type some
>> way?
>
> Usually people write a small global function helper.
Hm, so, something like this:
Foo!(T) newFoo(T)(T val)
{
return new Foo!(T)(val);
}
...
auto o = newFoo(5);
Works! Ha! How silly.
Thanks!
>
>
>> (Side note: What _does_ that error message mean? I don't get it.)
>
> I think the meaning is: when a class template is not yet instantiated, it's not a type yet.
>
> Bye,
> bearophile
More information about the Digitalmars-d-learn
mailing list