Boost logo

Boost :

Subject: Re: [boost] [outcome] Possible extensions/changes to std::experimental::expected
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-26 12:48:24


Andrzej Krzemienski wrote:
> 2017-05-26 14:22 GMT+02:00 Peter Dimov via Boost <boost_at_[hidden]>:
>
> > Andrzej Krzemienski wrote:
> >
> > Maybe no-one uses expected<T> as function parameter, but consider this:
> >>
> >> expected<vector<T>> g()
> >> {
> >> vector<T> v;
> >> // try to populate v;
> >> return v; // are you expecting a copy elision here?
> >> }
> >>
> >
> > This should move (subject to a clarification in the core language
> > though.)
>
> Is this some recent addition?

Moving on return is C++11, but it only kicked in when the types were the
same. In C++17, the wording is different and it seems that the intent is for
the above to also move (assuming that expected<T> has a constructor taking
T&&.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk