C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Copy-construct, move-construct, and PR-construct

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Tue, 5 Sep 2023 15:53:34 -0400
On Tue, Sep 5, 2023 at 2:54 PM Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Tuesday, 5 September 2023 00:37:09 PDT Frederick Virchanza Gotham via Std-
> Proposals wrote:
> > Anyone wanna take a bite out of this?
> >
> > What we're trying to do is figure out a way of using
> > std::optional::emplace to put the unmovable-and-uncopiable return
> > value of a function inside an std::optional (or 'variant' or 'any').
>
> Solution: move from the return type to a parameter passed by reference.

Which requires creating a new API. The goal here is to take the
already existing (and common) idiom of emplacement and allow it to
work through an indirect call.

Received on 2023-09-05 19:53:47