<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 20 October 2016 at 01:38, Jonathan M Davis via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wednesday, October 19, 2016 07:55:19 Andrei Alexandrescu via Digitalmars-d<br>
wrote:<br>
<span class="">> This was C++'s big un' that led to many complications. If the overload<br>
> weren't ambiguous, a large part of rvalue references would have been<br>
> unneeded. (Universal references would still have been necessary for<br>
> perfect forwarding, but that's not the bulk.)<br>
><br>
> In order to avoid such issues, we steered clear off binding rvalues to<br>
> ref parameters in the D language. As I mentioned to Ethan, I do agree a<br>
> careful definition may be able to avoid the fallout that happened in<br>
> C++. It would be a fair amount of work.<br>
<br>
</span>The other big problem is that D's const is so much more restrictive than<br>
C++'s that even if const ref accepted rvalues, a large portion of the time,<br>
it would be too restrictive to be useful.<br></blockquote><div><br></div><div>I've never seen a piece of code in C++ that receives const& that isn't strictly read-only.</div><div>I can't imagine from experience how D's const would change the usefulness of the pattern.</div></div></div></div>