Binding rvalues to ref [WAS: I close BIP27. I won't be pursuing BIPs anymore]

Manu via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 19 17:23:35 PDT 2016


On 20 October 2016 at 01:38, Jonathan M Davis via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> 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.
>

I've never seen a piece of code in C++ that receives const& that isn't
strictly read-only.
I can't imagine from experience how D's const would change the usefulness
of the pattern.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20161020/29888e69/attachment.html>


More information about the Digitalmars-d mailing list