auto ref

Mikhail Dahl mikhail at nevertobeknown.com
Wed Dec 16 00:12:02 PST 2009


On 16/12/2009 07:41, Walter Bright wrote:
> Mikhail Dahl wrote:
>> Just to confirm (I'm just getting into D, so I don't know much about
>> the language, still learning), but the idea is to apply 'auto' not
>> only to types but also to storage classes? As in 'automatically apply
>> ref in the case of lvalue'?
>
> Yes, exactly.
>
>
>> If so I'm a little confused by 'auto ref foo(...' - if auto ref here
>> is also simply an 'apply ref in the case of lvalue', then where is the
>> return type being inferred from?
>
>  From the return statement in the body of the function.

Ah yeah sorry, it's too obvious. That's what happens at 8am when you've 
had no sleep.



More information about the Digitalmars-d mailing list