Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Macro BOOST_MOVE_TO_LV

BOOST_MOVE_TO_LV

Synopsis

// In header: <boost/move/core.hpp>

BOOST_MOVE_TO_LV(ARG)

Description

This macro is used to achieve portable optimal move constructors.

In C++03 mode, when accessing a member of type through a rvalue (implemented as a rv<T> & type, where rv<T> derives from T) triggers a potential UB as the program never creates objects of type rv<T>. This macro casts back rv<T> to T& so that access to member types are done through the original type.

In C++11 compilers the cast from a rvalue reference of a derived type to a rvalue reference of a base type is implicit, so it's a no-op.


PrevUpHomeNext