Auto return type inference issue?

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 23 19:12:13 PDT 2014


On Wednesday, 23 April 2014 at 23:05:39 UTC, Matthew Dudley wrote:
> tuple in this case would be the member variable of type T (from 
> T...) So wouldn't elem be the actual object, and not the type?
>
> The effective lowering I was hoping for would be something like 
> this
>
> if (names[0] == "one")
>     return tuple[0];
> if (names[1] == "one")
>     return tuple[1];
>
> etc...

You're probably right, in which case both of those will be null 
and they are both different types.

That is to say tuple[0] is A.init and tuple[1] is B.init of which 
a function must only return one type.


More information about the Digitalmars-d-learn mailing list