C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Return Value Optimisation whenever you need it (guaranteed elision)

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 16 Jul 2023 11:14:48 -0400
On Sun, Jul 16, 2023 at 9:57 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Sun, Jul 16, 2023 at 2:13 PM Arthur O'Dwyer wrote:
> >
> > I think this is a legitimately interesting "puzzle"; although I don't think it currently merits any change to the core language nor to the standard library.
>
>
> I'm not sure if we're singing from the same hymn sheet here. . .
> but anyway I figured out how to return a mutex by value from a
> function, and to have that mutex placed inside a global
> 'std::optional' variable.
> Check it out:
>
> https://godbolt.org/z/5zqfb93bx
>
> Next I will combine this code with my previous code so that we can:
> Step 1 : Return a locked mutex by value from a function
> Step 2 : Have that locked mutex placed inside a global
> std::optional variable

That's neat and all, but that doesn't really address the core issues.
Nobody claimed that the functionality was unimplementable, so showing
a way of doing it through inline assembly isn't really addressing any
of the things people are talking about.

Received on 2023-07-16 15:15:11