Date: Tue, 21 May 2024 15:15:49 +0200
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_at_[hidden]>
Gesendet:Di 21.05.2024 00:00
Betreff:Re: [std-proposals] std::elide
An:std-proposals_at_[hidden];
CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>;
On Mon, May 20, 2024 at 9:51 PM Sebastian Wittmeier via Std-Proposals
<std-proposals_at_[hidden]> 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
Received on 2024-05-21 13:15:52