<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">On 5 Oct 2017 14:54, &quot;Ville Voutilainen&quot; &lt;<a href="mailto:ville.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On 6 October 2017 at 00:48, Richard Smith &lt;<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>&gt; wrote:<br>
&gt; On 5 Oct 2017 14:20, &quot;Ville Voutilainen&quot; &lt;<a href="mailto:ville.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt; On 5 October 2017 at 23:50, Richard Smith &lt;<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>&gt; wrote:<br>
&gt;&gt; What benefit does the feature-test macro give you over using the<br>
&gt;&gt; non-guaranteed-copy-elision implementation in all cases?<br>
&gt;<br>
&gt; I can let users store the thing returned by the factory function as<br>
&gt; they would store any object,<br>
&gt; rather than force them to use lifetime-extending references.<br>
&gt;<br>
&gt;<br>
&gt; One of us is missing something. Why does that not work with<br>
&gt; the non-guaranteed-copy-elision implementation?<br>
<br>
</div>I can&#39;t write<br>
NoCopyNorMove x = factory();<br>
in C++14. It&#39;s ill-formed. Same goes for<br>
auto x = factory();</blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">The macro does not help you with that. It does not magically make a C++17 feature appear in C++14 mode.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">
<br>
&gt;<br>
&gt; Furthermore, if I decide that I really<br>
&gt; hate having to use those references, I will disable the whole type if<br>
&gt; guaranteed copy elision is not available.<br>
&gt;<br>
&gt;<br>
&gt; Do you anticipate actually wanting to do that? It seems like an odd choice<br>
&gt; to permit the reference declaration only if guaranteed copy elision is<br>
&gt; available.<br>
<br>
</div>The choice is that rather than performing tricks with having to<br>
befriend every possible factory function<br>
and forcing users to use lifetime-extending references, such RAII<br>
handles are provided only when copy<br>
elision is available, and otherwise completely different tools need to be used.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I think we&#39;re still missing an example of that.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This discussion generalizes to the following: mandatory copy elision<br>
allows doing things that were not doable<br>
before. That provides ample reason to have a feature macro for it, as<br>
far as I&#39;m concerned.<br>
</blockquote></div><br></div></div></div>