Another more flexible variant could be a
template<class T>
std::forward_modified(Callable getter, Callable modifier);
which would not construct the initial object by itself, but take the return value of another function as argument (with guaranteed RVO).
return std::forward_modified(getmutex, lockit);
-----Ursprüngliche Nachricht-----
Von: Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Di 21.05.2024 00:00
Betreff: Re: [std-proposals] std::elide
An: std-proposals@lists.isocpp.org;
CC: Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>;
On Mon, May 20, 2024 at 9:51 PM Sebastian Wittmeier via Std-Proposals
<std-proposals@lists.isocpp.org> wrote:
>
> This feature request could be also made to a standard library function.
>
> // Calls the constructor and a setup function. With guaranteed RVO.
>
> T std::factory<T>(params, ..., setup)
>
> No need for other language changes or any special exception handling.
I've tried to implement it here:
https://godbolt.org/z/v99dvGqnn