Boost logo

Boost :

Subject: [boost] [move] BOOST_RV_REF(TypeWithoutMoveEmulation) parameters
From: Groke, Paul (paul.groke_at_[hidden])
Date: 2017-05-19 14:16:33


Hi,

I'd like to use BOOST_RV_REF, with both C++98 and C++11 compilers, for some sink-functions, with types that are not "move-enabled". I.e. types that the sink can "consume"/"move from" by other means (swapping, calling .release(), ...). Some of them I can - eventually - change to be fully move-enabled, others I can not (e.g. STL classes).

I just assumed that this was possible by simply passing the argument with boost::move(arg). Apparently it's not though, because boost::move will return a plain T& for types without move emulation.
For the time being I have defined my own helper function template "move_any" that will always return a rv<T>&.

Is there such a function that I missed? And if not, would you think it'd make sense to provide one (I certainly think it would)?

Regards,
Paul Groke


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