structs are now lvalues - what is with "auto ref"?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Dec 24 10:42:49 PST 2012


On 12/24/12 12:57 PM, Jonathan M Davis wrote:
> On Monday, December 24, 2012 12:37:54 Andrei Alexandrescu wrote:
>> An important smoking gun is C++'s min(), which is allows writing unsafe
>> code without casts.
>>
>> const int&  haveANiceDay = min(4, 5);
>
> But what does that have to do with const&  for function parameters?

min takes its parameters by const ref.

Andrei


More information about the Digitalmars-d-learn mailing list