C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Achieving NRVO with std::factory and std::after_factory

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sun, 9 Jun 2024 00:37:58 +0100
On Sat, Jun 8, 2024 at 9:29 PM I wrote:
>
> Both 'std::factory' and 'std::after_factory' can be supplied with
> arguments to pass to the constructor (or to the callable functor).


I've implemented the both of them in this GodBolt:

    https://godbolt.org/z/doKr5fq8T

That code will work properly on every C++ compiler even though it's
supposed to be UB. The only thing it's missing is that I can't make
either of them constexpr. Compiler support (aka compiler magic) is
required to make them constexpr.

Received on 2024-06-08 23:38:09