[SG10] A feature macro for mandatory copy elision

Richard Smith richard at metafoo.co.uk
Mon Oct 9 18:16:27 CEST 2017


On 9 Oct 2017 09:08, "Nelson, Clark" <clark.nelson at intel.com> wrote:

> After a while pondering, the best example I've got to demonstrate a
> need for the feature test macro is something like this:
>
> #ifdef __cpp_mandatory_copy_elision
>
> NoCopyNoMove indirectFactory() {
>   return factory(1); // ill-formed prior to C++17
> }
> #endif

At this point I gather that no one has an objection to providing a macro
for mandatory copy elision.


I think that's correct.

Should SD-6 contain an example like this one? It seems to me that there
ought to be a different definition of indirectFactory under an #else, but I
don't know what it should look like.


For this example, depending on the intent of the library author it may be
impossible to provide an alternate definition. The feature test macro
allows this portion of the interface to be omitted if it's nonessential.

Clark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/features/attachments/20171009/03c655c2/attachment.html 


More information about the Features mailing list