I should quickly explain why rvalue ref support is so important to proposed Boost.AFIO: it's a 100% batch API and therefore takes in batches of things to do and returns out batches of results. That implies lots of passing sequences of things around in STL containers, which without rvalue refs are not cheap to copy. Therefore while we could get the library working on
Maybe BOOST_ASIO_MOVE_ARG (in boost/asio/detail/config.hpp) will work for you.
I don't understand how that makes std::vector<> or any other STL container suddenly magically start not copy constructing its contents on C++03 compilers. struct async_io_op has both rvalue and const lvalue copy and assignment constructors. It's left up to the compiler and STL container implementation to decide when and where to use them. I agree we should be using more std::move() to help the compiler where it needs it, but all performance tuning is being left till after the Boost import. Niall --- Opinions expressed here are my own and do not necessarily represent those of BlackBerry Inc.
On 06/18/2013 12:03 AM, Niall Douglas wrote:
I don't understand how that makes std::vector<> or any other STL container suddenly magically start not copy constructing its contents on C++03 compilers.
Other than trying to fall back to const references, there is no magic there. But it does enable you to use rvalue references on C++11 compliant compilers, and revert to other mechanisms (e.g. const references or copying) for older compilers.
participants (2)
-
Bjorn Reese
-
Niall Douglas