Destructors, const structs, and opEquals

Jonathan M Davis jmdavisProg at gmx.com
Sat Dec 4 02:35:29 PST 2010


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. Is there something bad about it? I'd probably use const ref a lot more, 
but because it will only take lvalues, it's _highly_ limiting. If you could 
overload functions on ref (I _think_ that there's a bug on that), then you could 
have two versions of opEquals - with with const ref and one which would copy the 
value - but ideally, you'd only need the one with const ref.

- Jonathan M Davis


More information about the Digitalmars-d mailing list