Templated functions: explicit and implicit instantiation at the same time?
Don Clugston
dac at nospam.com.au
Thu Nov 1 09:00:37 PDT 2007
Jarrett Billingsley wrote:
> "Don Clugston" <dac at nospam.com.au> wrote in message
> news:fgc15n$226b$1 at digitalmars.com...
>> Do it in two levels.
>>
>> template func(R=int)
>> {
>> R func(T)(T t) {...}
>> }
>
> First thing I tried. This works for the explicit case, but you can't call
> it with IFTI, since func is no longer a function template. I wish the 'is
> this a function template?' check were a little more lenient/intelligent in
> some cases.
>
>
Oh, yeah. Now I remember. You still have to put in a !(). Bummer.
func!(long)(3.0i);
func!()(4.0);
That was the best I could find, around DMD 1.0.
More information about the Digitalmars-d-learn
mailing list