C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sun, 16 Jul 2023 12:54:36 +0100
On Sun, Jul 16, 2023 at 11:30 AM Jens Maurer <jens.maurer_at_[hidden]> wrote:
>
> If this topic interests you, may I suggest to contact the original
> paper author and ask about the whereabouts of this paper; maybe
> you can pursue it instead.


Emailed him yesterday, nothing back yet. For the time being I will
re-write the code to accommodate lambdas-with-captures by using
"std::function<void(void*)>" instead of function pointers. When I have
that working, I'll try port it to Microsoft x64. After that I'll do
aarch64. Then I might do 32-Bit cdecl, followed by stdcall.

When I have them all implemented and in one concise paper with many
links to GodBolt, maybe some committee members will start to like the
smell of it.

And best of all it won't need a core language change.

Also I will write a function that can place the mutex inside an
std::optional, so that we can do the following:

std::optional< std::mutex > om;

std::mutex Func(int const dummy, double const dummy2)
{
    (void)dummy;
    (void)dummy2;
    return std::mutex();
}

int main(void)
{
    put_retval_in_optional(om, Func)(6, 7.24);

    // Now 'om' contains the mutex that was returned by value
}

Received on 2023-07-16 11:54:46