Const ref and rvalues again...

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 6 16:46:51 PST 2012


On Wednesday, November 07, 2012 01:32:03 martin wrote:
> So we do not really need 'auto ref' for non-templated functions
> or a new, even more confusing keyword which you, Jonathan, seem
> to insist on - 'const ref' (or, more elegantly 'in ref') is all
> we need.

No, because that would be doing the same thing as C++, which Walter and Andrei 
have already rejected. They specifically do _not_ want there to be any 
ambiguity between whether a const ref variable is an lvalue or rvalue. If they 
were willing to make const ref work the same as C++'s const&, then we would 
never have had this problem in the first place. We specifically need something 
other than const ref. The const ref can continue to work as it does now, but 
we'll have a way to get semantics similar to C++'s const& when we want them.

- Jonathan M Davis


More information about the Digitalmars-d mailing list