Binding rvalues to ref [WAS: I close BIP27. I won't be pursuing BIPs anymore]
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Wed Oct 19 08:38:42 PDT 2016
On Wednesday, October 19, 2016 07:55:19 Andrei Alexandrescu via Digitalmars-d
wrote:
> This was C++'s big un' that led to many complications. If the overload
> weren't ambiguous, a large part of rvalue references would have been
> unneeded. (Universal references would still have been necessary for
> perfect forwarding, but that's not the bulk.)
>
> In order to avoid such issues, we steered clear off binding rvalues to
> ref parameters in the D language. As I mentioned to Ethan, I do agree a
> careful definition may be able to avoid the fallout that happened in
> C++. It would be a fair amount of work.
The other big problem is that D's const is so much more restrictive than
C++'s that even if const ref accepted rvalues, a large portion of the time,
it would be too restrictive to be useful.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list