feelfree feelfree - 4 months ago 9
C++ Question

the counterpart of std::move in boost library

I am trying to use

std::move
in my codes, but the compiler (g++ 4.4) I am using does not support it. Can
boost::move
substitute
std::move
completely? Thanks.

Answer

std::move (and boost::move) is just a cast from T& to T&&. It does not actually move anything. This means that the specific type of pointer T&& must be supported by the compiler. GCC supports r-value references since version 4.3, so the boost version should be fine.

However, is there a reason you can't use std::move from #include <utility>?

http://en.cppreference.com/w/cpp/utility/move

You just need to make sure to specify -std=c++0x as a compiler option in order to enable the limited c++11 support that gcc 4.4 has.