July 20, 2011 Function template type parameter inference | ||||
---|---|---|---|---|
| ||||
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? |
July 20, 2011 Re: Function template type parameter inference | ||||
---|---|---|---|---|
| ||||
Posted in reply to csci | 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 |
Copyright © 1999-2021 by the D Language Foundation