Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
core.hpp File Reference

This header implements macros to define movable classes and move-aware functions. More...

#include <boost/move/detail/config_begin.hpp>
#include <boost/move/detail/config_end.hpp>
Include dependency graph for core.hpp:
This graph shows which files directly or indirectly include this file:

Classes

struct  boost::has_move_emulation_enabled< T >
 This trait yields to a compile-time true boolean if T was marked as BOOST_MOVABLE_BUT_NOT_COPYABLE or BOOST_COPYABLE_AND_MOVABLE and rvalue references are not available on the platform. More...
 
struct  boost::move_detail::forward_type< T >
 

Namespaces

 boost
 Duration formatting facet for input.
 
 boost::move_detail
 

Macros

#define BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)
 
#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)
 This macro marks a type as movable but not copyable, disabling copy construction and assignment. More...
 
#define BOOST_COPYABLE_AND_MOVABLE(TYPE)
 This macro marks a type as copyable and movable. More...
 
#define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)
 
#define BOOST_RV_REF(TYPE)   TYPE && \
 This macro is used to achieve portable syntax in move constructors and assignments for classes marked as BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE. More...
 
#define BOOST_RV_REF_BEG   \
 This macro is used to achieve portable syntax in move constructors and assignments for template classes marked as BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE. More...
 
#define BOOST_RV_REF_END   && \
 This macro is used to achieve portable syntax in move constructors and assignments for template classes marked as BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE. More...
 
#define BOOST_COPY_ASSIGN_REF(TYPE)   const TYPE & \
 This macro is used to achieve portable syntax in copy assignment for classes marked as BOOST_COPYABLE_AND_MOVABLE. More...
 
#define BOOST_FWD_REF(TYPE)   TYPE && \
 This macro is used to implement portable perfect forwarding as explained in the documentation. More...
 
#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)   TYPE<ARG1, ARG2> && \
 
#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)   TYPE<ARG1, ARG2, ARG3> && \
 
#define BOOST_COPY_ASSIGN_REF_BEG   const \
 
#define BOOST_COPY_ASSIGN_REF_END   & \
 
#define BOOST_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)   const TYPE<ARG1, ARG2> & \
 
#define BOOST_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)   const TYPE<ARG1, ARG2, ARG3>& \
 
#define BOOST_CATCH_CONST_RLVALUE(TYPE)   const TYPE & \
 
#define BOOST_MOVE_RET(RET_TYPE, REF)   REF
 This macro is used to achieve portable move return semantics. More...
 

Detailed Description

This header implements macros to define movable classes and move-aware functions.

Macro Definition Documentation

#define BOOST_CATCH_CONST_RLVALUE (   TYPE)    const TYPE & \
#define BOOST_COPY_ASSIGN_REF (   TYPE)    const TYPE & \

This macro is used to achieve portable syntax in copy assignment for classes marked as BOOST_COPYABLE_AND_MOVABLE.

#define BOOST_COPY_ASSIGN_REF_2_TEMPL_ARGS (   TYPE,
  ARG1,
  ARG2 
)    const TYPE<ARG1, ARG2> & \
#define BOOST_COPY_ASSIGN_REF_3_TEMPL_ARGS (   TYPE,
  ARG1,
  ARG2,
  ARG3 
)    const TYPE<ARG1, ARG2, ARG3>& \
#define BOOST_COPY_ASSIGN_REF_BEG   const \
#define BOOST_COPY_ASSIGN_REF_END   & \
#define BOOST_COPYABLE_AND_MOVABLE (   TYPE)

This macro marks a type as copyable and movable.

The user will need to write a move constructor/assignment and a copy assignment as explained in the documentation to fully write a copyable and movable class.

#define BOOST_COPYABLE_AND_MOVABLE_ALT (   TYPE)
#define BOOST_FWD_REF (   TYPE)    TYPE && \

This macro is used to implement portable perfect forwarding as explained in the documentation.

#define BOOST_MOVABLE_BUT_NOT_COPYABLE (   TYPE)
Value:
public:\
typedef int boost_move_emulation_t;\
#define BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)
Definition: core.hpp:33

This macro marks a type as movable but not copyable, disabling copy construction and assignment.

The user will need to write a move constructor/assignment as explained in the documentation to fully write a movable but not copyable class.

#define BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN (   TYPE)
Value:
public:\
TYPE(TYPE const &) = delete;\
TYPE& operator=(TYPE const &) = delete;\
public:\
typedef int boost_move_no_copy_constructor_or_assign; \
private:\
cpp_int_backend & operator=(const cpp_int_backend< MinBits2, MaxBits2, SignType2, Checked2, Allocator2 > &other)
Definition: cpp_int.hpp:1117
#define BOOST_MOVE_RET (   RET_TYPE,
  REF 
)    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.

#define BOOST_RV_REF (   TYPE)    TYPE && \

This macro is used to achieve portable syntax in move constructors and assignments for classes marked as BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE.

#define BOOST_RV_REF_2_TEMPL_ARGS (   TYPE,
  ARG1,
  ARG2 
)    TYPE<ARG1, ARG2> && \
#define BOOST_RV_REF_3_TEMPL_ARGS (   TYPE,
  ARG1,
  ARG2,
  ARG3 
)    TYPE<ARG1, ARG2, ARG3> && \
#define BOOST_RV_REF_BEG   \

This macro is used to achieve portable syntax in move constructors and assignments for template classes marked as BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE.

As macros have problems with comma-separated template arguments, the template argument must be preceded with BOOST_RV_REF_BEG and ended with BOOST_RV_REF_END

#define BOOST_RV_REF_END   && \

This macro is used to achieve portable syntax in move constructors and assignments for template classes marked as BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE.

As macros have problems with comma-separated template arguments, the template argument must be preceded with BOOST_RV_REF_BEG and ended with BOOST_RV_REF_END