I would put std::move there so that there is movement, because otherwise it will not be. :)
Alternative is
auto MakeBig = [&]()->BigClass { BigClass big; //prepare big somehow return big; // must be a `move`, if not elided! }; OtherClass foo(MakeBig(), maybe, other, params);
or, if you are not weak in heart:
OtherClass foo([&]()->BigClass { BigClass big; //prepare big somehow return big; // must be a `move`, if not elided! }(), maybe, other, params);
where we end up creating big up in lambda and then defer creation. This does not always work, mind you.
The advantage of this pattern is that the move can be undone if foo takes its first argument by value, and taking by value is now the right way to do this for the move class, which OtherClass will copy anyway. If it does not accept its first argument by value, the temporary one created to build foo can still be deleted, so only one move will happen (between the temporary and foo ).
Yakk
source share