temporary objects are not allowed to be pass by ref anymore

Lutger lutger.blijdestijn at gmail.com
Sun Apr 19 23:04:30 PDT 2009


Andrei Alexandrescu wrote:
...
> Now onto why ref was disallowed to bind to an rvalue. This is because 
> some functions take things by ref intending to change them. Passing an 
> rvalue is in such cases a bug.
> 
> I agree there are functions that only want to use ref for speed 
> purposes. I suggested Walter to use ref? for those. ref? means it could 
> be an rvalue or an lvalue.
> 
> 
> Andrei

Since passing by const ref cannot change the parameter, is it possible to 
allow that for rvalues?





More information about the Digitalmars-d mailing list