Template method and type resolution of return type

David Held via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 19 17:55:23 PDT 2014


On 4/19/2014 3:31 PM, Andrej Mitrovic via Digitalmars-d-learn wrote:
> [...]
> struct S
> {
>      int get()  { return 0; }
>      T get(T)() { return T.init; }
> }
>
> void main()
> {
>      S s;
>      float x = s.get();  // which overload? (currently int get())
> }

Isn't this just because concrete methods are better overload candidates 
than method templates?

Dave



More information about the Digitalmars-d-learn mailing list