Call site 'ref'
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jan 18 09:13:09 PST 2012
On 1/15/12 7:21 PM, Timon Gehr wrote:
> On 01/16/2012 02:00 AM, Andrei Alexandrescu wrote:
>> On 1/15/12 6:38 PM, Timon Gehr wrote:
>>> On 01/16/2012 01:35 AM, Andrei Alexandrescu wrote:
>>>> On 1/15/12 6:30 PM, Peter Alexander wrote:
>>>>> On 15/01/12 11:56 PM, Jonathan M Davis wrote:
>>>>>> On Monday, January 16, 2012 00:41:14 Timon Gehr wrote:
>>>>>>> Well, struct literals are lvalues, at least in DMD.
>>>>>>
>>>>>> Yeah. I don't understand that. I've argued about it with Walter
>>>>>> before.
>>>>>> Apparently they are in C++ as well. I don't understand it. It
>>>>>> makes it
>>>>>> so that
>>>>>
>>>>> In C++, struct literals are rvalues. C++ just has a special rule that
>>>>> const references can bind to rvalues (but non-const references
>>>>> cannot),
>>>>
>>>> That's a bad rule that we shouldn't copy.
>>>>
>>>> Andrei
>>>
>>> What do you think is an optimal rule regarding struct
>>> literals/lvalues/rvalues and ref parameters?
>>
>> auto ref
>>
>> Andrei
>
> But that only works for templates?
For non-templates, if it's important to distinguish between lvalues and
rvalues, use two overloads.
Andrei
More information about the Digitalmars-d
mailing list