Problems with D const ref vs C++ const &

Craig Black craigblack2 at cox.net
Fri Dec 10 16:18:49 PST 2010


"Don" <nospam at nospam.com> wrote in message 
news:idu7km$5ea$1 at digitalmars.com...
> Andrei Alexandrescu wrote:
>> On 12/10/10 12:47 PM, Craig Black wrote:
>>>>
>>>> auto ref should work for non-templates and generate only one function.
>>>> The current implementation of auto ref originates in a 
>>>> misunderstanding.
>>>>
>>>>
>>>> Andrei
>>>
>>> Thanks for the response. I assume Walter is aware of this problem? What
>>> are the chances that this gets fixed soon?
>>
>> There are various pressures on Walter's and Don's time, but generally the 
>> problems that cause people pain are more discussed around here and tend 
>> to be looked at sooner.
>>
>> Andrei
>
> It didn't seem to me that there was a convincing outcome from that 
> discussion. We need an actual spec!
> (I only fix bugs. I don't make language decisions).
>
> In my opinion, the signature of opEquals is a litmus test for the const 
> system.
> If it's elegant, we've struck gold.
> If it isn't, we've still got work to do.

It seems to me that opEquals would work fine if the non-template auto ref 
was used.  As Andrei described it, it should only generate one version of 
the function, and all parameters, including temporaries, should be passed by 
reference.

But maybe I misunderstood Andrei or maybe I missed some caveat with 
opEquals?

-Craig 



More information about the Digitalmars-d mailing list