Destructors, const structs, and opEquals

Jonathan M Davis jmdavisProg at gmx.com
Sat Dec 4 06:29:13 PST 2010


On Saturday 04 December 2010 06:00:58 Andrei Alexandrescu wrote:
> On 12/4/10 4:35 AM, Jonathan M Davis wrote:
> > On Friday 03 December 2010 22:42:06 Don wrote:
> >> (1) Should temporaries be allowed to be passed as 'const ref'?
> > 
> > I honestly do not understand why they can't be already. C++ definitely
> > allows this.
> 
> C++'s second biggest mistake.

Okay. Why is it a mistake? I've never heard anyone say that this was a mistake 
before. As far as I can tell, it's extremely desirable, and this problem with 
opEquals() is a prime example as to why. What is wrong with allowing temporaries 
to be passed as const ref? What makes it such a big mistake?

- Jonathan M Davis


More information about the Digitalmars-d mailing list