Make definition of ASIO_MOVE_ARG and ASIO_MOVE_CAST separate to the definition of ASIO_HAS_MOVE, to allow the latter to be user-defined.
diff --git a/asio/include/asio/detail/config.hpp b/asio/include/asio/detail/config.hpp index 10ab1e0..abdd0b2 100644 --- a/asio/include/asio/detail/config.hpp +++ b/asio/include/asio/detail/config.hpp
@@ -52,17 +52,23 @@ # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) # if defined(__GXX_EXPERIMENTAL_CXX0X__) # define ASIO_HAS_MOVE -# define ASIO_MOVE_ARG(type) type&& -# define ASIO_MOVE_CAST(type) static_cast<type&&> # endif // defined(__GXX_EXPERIMENTAL_CXX0X__) # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) # endif // defined(__GNUC__) #endif // !defined(ASIO_DISABLE_MOVE) -// If ASIO_MOVE_CAST isn't defined yet use a C++03 compatible version. -// Note that older g++ and MSVC versions don't like it when you pass a -// non-member function through a const reference, so for most compilers we'll -// play it safe and stick with the old approach of passing the handler by +// If ASIO_MOVE_CAST isn't defined, and move support is available, define +// ASIO_MOVE_ARG and ASIO_MOVE_CAST to take advantage of rvalue references and +// perfect forwarding. +#if defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST) +# define ASIO_MOVE_ARG(type) type&& +# define ASIO_MOVE_CAST(type) static_cast<type&&> +#endif // defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST) + +// If ASIO_MOVE_CAST still isn't defined then default to a C++03-compatible +// implementation. Note that older g++ and MSVC versions don't like it when you +// pass a non-member function through a const reference, so for most compilers +// we'll play it safe and stick with the old approach of passing the handler by // value. #if !defined(ASIO_MOVE_CAST) # if defined(__GNUC__)