C++ Logo

sg10

Advanced search

Re: [SG10] A feature macro for mandatory copy elision

From: Richard Smith <richard_at_[hidden]>
Date: Thu, 5 Oct 2017 14:48:07 -0700
On 5 Oct 2017 14:20, "Ville Voutilainen" <ville.voutilainen_at_[hidden]>
wrote:

On 5 October 2017 at 23:50, Richard Smith <richard_at_[hidden]> wrote:
> What benefit does the feature-test macro give you over using the
> non-guaranteed-copy-elision implementation in all cases?

I can let users store the thing returned by the factory function as
they would store any object,
rather than force them to use lifetime-extending references.


One of us is missing something. Why does that not work with
the non-guaranteed-copy-elision implementation?

Furthermore, if I decide that I really
hate having to use those references, I will disable the whole type if
guaranteed copy elision is not available.


Do you anticipate actually wanting to do that? It seems like an odd choice
to permit the reference declaration only if guaranteed copy elision is
available.

This example I have is, as usual, not the only use case for a feature macro.

Received on 2017-10-05 23:48:11