Function template type parameter inference

Simen Kjaeraas simen.kjaras at gmail.com
Wed Jul 20 07:38:48 PDT 2011


On Wed, 20 Jul 2011 07:52:58 +0200, csci <csci at nowhere.com> wrote:

> I noticed in the D spec it states that
>
> "Function template type parameters that are to be implicitly deduced may  
> not have
> specializations"
>
> However, the following code works:
>
> void Foo(T : double)(T t) { writefln("%f",t+2); }
> ...
> Foo(5.5);
>
> I was wondering if this is behavior that can be relied upon, or if it  
> may change
> in the future? Or am I misreading things?

It would very much seem you are correct in your interpretation. I
question however, the validity of that part of the spec.

In short, it works now, and I see no reason for that not to work.

-- 
   Simen


More information about the Digitalmars-d-learn mailing list