<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">On 5 Oct 2017 14:54, "Ville Voutilainen" <<a href="mailto:ville.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>> 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 <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
> On 5 Oct 2017 14:20, "Ville Voutilainen" <<a href="mailto:ville.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>><br>
> wrote:<br>
><br>
> On 5 October 2017 at 23:50, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
>> What benefit does the feature-test macro give you over using the<br>
>> non-guaranteed-copy-elision implementation in all cases?<br>
><br>
> I can let users store the thing returned by the factory function as<br>
> they would store any object,<br>
> rather than force them to use lifetime-extending references.<br>
><br>
><br>
> One of us is missing something. Why does that not work with<br>
> the non-guaranteed-copy-elision implementation?<br>
<br>
</div>I can't write<br>
NoCopyNorMove x = factory();<br>
in C++14. It'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>
><br>
> Furthermore, if I decide that I really<br>
> hate having to use those references, I will disable the whole type if<br>
> guaranteed copy elision is not available.<br>
><br>
><br>
> Do you anticipate actually wanting to do that? It seems like an odd choice<br>
> to permit the reference declaration only if guaranteed copy elision is<br>
> 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'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'm concerned.<br>
</blockquote></div><br></div></div></div>