123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515 |
- #ifndef BOOST_MOVE_CORE_HPP
- #define BOOST_MOVE_CORE_HPP
- #ifndef BOOST_CONFIG_HPP
- # include <boost/config.hpp>
- #endif
- #
- #if defined(BOOST_HAS_PRAGMA_ONCE)
- # pragma once
- #endif
- #include <boost/move/detail/config_begin.hpp>
- #include <boost/move/detail/workaround.hpp>
- #if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
- #define BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE) \
- private:\
- TYPE(TYPE &);\
- TYPE& operator=(TYPE &);\
- public:\
- typedef int boost_move_no_copy_constructor_or_assign; \
- private:\
-
- #else
- #define BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE) \
- public:\
- TYPE(TYPE const &) = delete;\
- TYPE& operator=(TYPE const &) = delete;\
- public:\
- typedef int boost_move_no_copy_constructor_or_assign; \
- private:\
-
- #endif
- #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- #include <boost/move/detail/type_traits.hpp>
- #define BOOST_MOVE_TO_RV_CAST(RV_TYPE, ARG) reinterpret_cast<RV_TYPE>(ARG)
- #define BOOST_MOVE_TO_LV_CAST(LV_TYPE, ARG) static_cast<LV_TYPE>(ARG)
-
- #if defined(BOOST_GCC) && (BOOST_GCC >= 40400) && (BOOST_GCC < 40500)
- #define BOOST_RV_ATTRIBUTE_MAY_ALIAS BOOST_MAY_ALIAS
- #else
- #define BOOST_RV_ATTRIBUTE_MAY_ALIAS
- #endif
- namespace boost {
-
-
-
-
-
- template <class T>
- class BOOST_RV_ATTRIBUTE_MAY_ALIAS rv
- : public ::boost::move_detail::if_c
- < ::boost::move_detail::is_class<T>::value
- , T
- , ::boost::move_detail::nat
- >::type
- {
- rv();
- ~rv() throw();
- rv(rv const&);
- void operator=(rv const&);
- };
-
-
-
-
-
- namespace move_detail {
- template <class T>
- struct is_rv
- //Derive from integral constant because some Boost code assummes it has
- //a "type" internal typedef
- : integral_constant<bool, ::boost::move_detail::is_rv_impl<T>::value >
- {};
- template <class T>
- struct is_not_rv
- {
- static const bool value = !is_rv<T>::value;
- };
- }
-
-
-
-
-
- template<class T>
- struct has_move_emulation_enabled
- : ::boost::move_detail::has_move_emulation_enabled_impl<T>
- {};
- template<class T>
- struct has_move_emulation_disabled
- {
- static const bool value = !::boost::move_detail::has_move_emulation_enabled_impl<T>::value;
- };
- }
- #define BOOST_RV_REF(TYPE)\
- ::boost::rv< TYPE >& \
-
- #define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- ::boost::rv< TYPE<ARG1, ARG2> >& \
-
- #define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \
-
- #define BOOST_RV_REF_BEG\
- ::boost::rv< \
-
- #define BOOST_RV_REF_END\
- >& \
-
- #define BOOST_RV_REF_BEG_IF_CXX11 \
- \
-
- #define BOOST_RV_REF_END_IF_CXX11 \
- \
-
- #define BOOST_FWD_REF(TYPE)\
- const TYPE & \
-
- #define BOOST_COPY_ASSIGN_REF(TYPE)\
- const ::boost::rv< TYPE >& \
-
- #define BOOST_COPY_ASSIGN_REF_BEG \
- const ::boost::rv< \
-
- #define BOOST_COPY_ASSIGN_REF_END \
- >& \
-
- #define BOOST_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- const ::boost::rv< TYPE<ARG1, ARG2> >& \
-
- #define BOOST_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- const ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \
-
- #define BOOST_CATCH_CONST_RLVALUE(TYPE)\
- const ::boost::rv< TYPE >& \
-
- namespace boost {
- namespace move_detail {
- template <class Ret, class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
- < ::boost::move_detail::is_lvalue_reference<Ret>::value ||
- !::boost::has_move_emulation_enabled<T>::value
- , T&>::type
- move_return(T& x) BOOST_NOEXCEPT
- {
- return x;
- }
- template <class Ret, class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
- < !::boost::move_detail::is_lvalue_reference<Ret>::value &&
- ::boost::has_move_emulation_enabled<T>::value
- , ::boost::rv<T>&>::type
- move_return(T& x) BOOST_NOEXCEPT
- {
- return *BOOST_MOVE_TO_RV_CAST(::boost::rv<T>*, ::boost::move_detail::addressof(x));
- }
- template <class Ret, class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
- < !::boost::move_detail::is_lvalue_reference<Ret>::value &&
- ::boost::has_move_emulation_enabled<T>::value
- , ::boost::rv<T>&>::type
- move_return(::boost::rv<T>& x) BOOST_NOEXCEPT
- {
- return x;
- }
- template <class T>
- BOOST_MOVE_FORCEINLINE T& unrv(::boost::rv<T> &rv) BOOST_NOEXCEPT
- { return BOOST_MOVE_TO_LV_CAST(T&, rv); }
- }
- }
- #define BOOST_MOVE_RET(RET_TYPE, REF)\
- boost::move_detail::move_return< RET_TYPE >(REF)
-
- #define BOOST_MOVE_BASE(BASE_TYPE, ARG) \
- ::boost::move((BASE_TYPE&)(ARG))
-
- #define BOOST_MOVE_TO_LV(ARG) \
- ::boost::move_detail::unrv(ARG)
-
-
-
-
-
-
- #define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
- BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)\
- public:\
- BOOST_MOVE_FORCEINLINE operator ::boost::rv<TYPE>&() \
- { return *BOOST_MOVE_TO_RV_CAST(::boost::rv<TYPE>*, this); }\
- BOOST_MOVE_FORCEINLINE operator const ::boost::rv<TYPE>&() const \
- { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv<TYPE>*, this); }\
- private:\
-
-
-
-
-
-
- #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
- public:\
- inline TYPE& operator=(TYPE &t)\
- { this->operator=(const_cast<const TYPE&>(t)); return *this;}\
- public:\
- inline operator ::boost::rv<TYPE>&() \
- { return *BOOST_MOVE_TO_RV_CAST(::boost::rv<TYPE>*, this); }\
- inline operator const ::boost::rv<TYPE>&() const \
- { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv<TYPE>*, this); }\
- private:\
-
- #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\
- public:\
- BOOST_MOVE_FORCEINLINE operator ::boost::rv<TYPE>&() \
- { return *BOOST_MOVE_TO_RV_CAST(::boost::rv<TYPE>*, this); }\
- BOOST_MOVE_FORCEINLINE operator const ::boost::rv<TYPE>&() const \
- { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv<TYPE>*, this); }\
- private:\
-
- namespace boost{
- namespace move_detail{
- template< class T>
- struct forward_type
- { typedef const T &type; };
- template< class T>
- struct forward_type< boost::rv<T> >
- { typedef T type; };
- }}
- #else
-
-
-
- #define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
- BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)\
- public:\
- typedef int boost_move_emulation_t;\
- private:\
-
-
-
-
- #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
-
- #if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\
-
- #endif
- namespace boost {
-
-
-
- template<class T>
- struct has_move_emulation_enabled
- {
- static const bool value = false;
- };
- template<class T>
- struct has_move_emulation_disabled
- {
- static const bool value = true;
- };
- }
-
-
-
- #define BOOST_RV_REF(TYPE)\
- TYPE && \
-
-
-
-
-
-
-
- #define BOOST_RV_REF_BEG\
- \
-
-
-
-
-
-
-
- #define BOOST_RV_REF_END\
- && \
-
-
-
- #define BOOST_RV_REF_BEG_IF_CXX11 \
- BOOST_RV_REF_BEG \
-
-
-
- #define BOOST_RV_REF_END_IF_CXX11 \
- BOOST_RV_REF_END \
-
-
-
- #define BOOST_COPY_ASSIGN_REF(TYPE)\
- const TYPE & \
-
-
-
- #define BOOST_FWD_REF(TYPE)\
- TYPE && \
-
- #if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- #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 & \
-
- #endif
- #if !defined(BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG) || defined(BOOST_MOVE_DOXYGEN_INVOKED)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #define BOOST_MOVE_RET(RET_TYPE, REF)\
- REF
-
- #else
- #include <boost/move/detail/meta_utils.hpp>
- namespace boost {
- namespace move_detail {
- template <class Ret, class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
- < ::boost::move_detail::is_lvalue_reference<Ret>::value
- , T&>::type
- move_return(T& x) BOOST_NOEXCEPT
- {
- return x;
- }
- template <class Ret, class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c
- < !::boost::move_detail::is_lvalue_reference<Ret>::value
- , Ret && >::type
- move_return(T&& t) BOOST_NOEXCEPT
- {
- return static_cast< Ret&& >(t);
- }
- }
- }
- #define BOOST_MOVE_RET(RET_TYPE, REF)\
- boost::move_detail::move_return< RET_TYPE >(REF)
-
- #endif
-
-
-
-
-
-
-
- #define BOOST_MOVE_BASE(BASE_TYPE, ARG) \
- ::boost::move((BASE_TYPE&)(ARG))
-
-
-
-
-
-
-
-
-
- #define BOOST_MOVE_TO_LV(ARG) ARG
-
- namespace boost {
- namespace move_detail {
- template< class T> struct forward_type { typedef T type; };
- }}
- #endif
- #include <boost/move/detail/config_end.hpp>
- #endif
|