Home | Libraries | People | FAQ | More |
BOOST_MOVE_RET
// In header: <boost/move/core.hpp>
BOOST_MOVE_RET(RET_TYPE, REF)
This macro is used to achieve portable move return semantics. The C++11 Standard allows implicit move returns when the object to be returned is designated by a lvalue and:
The criteria for elision of a copy operation are met OR
The criteria would be met save for the fact that the source object is a function parameter
For C++11 conforming compilers this macros only yields to REF: return BOOST_MOVE_RET(RET_TYPE, REF);
-> return REF;
For compilers without rvalue references this macro does an explicit move if the move emulation is activated and the return type (RET_TYPE) is not a reference.
For non-conforming compilers with rvalue references like Visual 2010 & 2012, an explicit move is performed if RET_TYPE is not a reference.
Caution: When using this macro in non-conforming or C++03 compilers, a move will be performed even if the C++11 standard does not allow it (e.g. returning a static variable). The user is responsible for using this macro only to return local objects that met C++11 criteria.