C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::elide

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Tue, 21 May 2024 16:43:00 +0100
On Tue, May 21, 2024 at 2:15 PM Sebastian Wittmeier wrote
>
> 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);


Implemented by combining 'std::elide' with 'std::factory':

    https://msvc.godbolt.org/z/9EMP6zzoe

Received on 2024-05-21 15:43:13