digitalmars.D.learn - Function template type parameter inference
- csci (9/9) Jul 19 2011 I noticed in the D spec it states that
- Simen Kjaeraas (6/17) Jul 20 2011 It would very much seem you are correct in your interpretation. I
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?
Jul 19 2011
On Wed, 20 Jul 2011 07:52:58 +0200, csci <csci 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
Jul 20 2011