123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- #ifndef BOOST_MOVE_MOVE_UTILITY_CORE_HPP
- #define BOOST_MOVE_MOVE_UTILITY_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> //forceinline
- #include <boost/move/core.hpp>
- #include <boost/move/detail/meta_utils.hpp>
- #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- namespace boost {
- template<class T>
- struct enable_move_utility_emulation
- {
- static const bool value = true;
- };
-
-
-
-
-
-
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < T &
- , enable_move_utility_emulation<T>
- , has_move_emulation_disabled<T>
- >::type
- move(T& x) BOOST_NOEXCEPT
- {
- return x;
- }
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < rv<T>&
- , enable_move_utility_emulation<T>
- , has_move_emulation_enabled<T>
- >::type
- move(T& x) BOOST_NOEXCEPT
- {
- return *BOOST_MOVE_TO_RV_CAST(::boost::rv<T>*, ::boost::move_detail::addressof(x) );
- }
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < rv<T>&
- , enable_move_utility_emulation<T>
- , has_move_emulation_enabled<T>
- >::type
- move(rv<T>& x) BOOST_NOEXCEPT
- {
- return x;
- }
-
-
-
-
-
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < T &
- , enable_move_utility_emulation<T>
- , ::boost::move_detail::is_rv<T>
- >::type
- forward(const typename ::boost::move_detail::identity<T>::type &x) BOOST_NOEXCEPT
- {
- return const_cast<T&>(x);
- }
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < const T &
- , enable_move_utility_emulation<T>
- , ::boost::move_detail::is_not_rv<T>
- >::type
- forward(const typename ::boost::move_detail::identity<T>::type &x) BOOST_NOEXCEPT
- {
- return x;
- }
-
-
-
-
-
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < T &
- , enable_move_utility_emulation<T>
- , ::boost::move_detail::is_rv<T>
- >::type
- move_if_not_lvalue_reference(const typename ::boost::move_detail::identity<T>::type &x) BOOST_NOEXCEPT
- {
- return const_cast<T&>(x);
- }
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < typename ::boost::move_detail::add_lvalue_reference<T>::type
- , enable_move_utility_emulation<T>
- , ::boost::move_detail::is_not_rv<T>
- , ::boost::move_detail::or_
- < ::boost::move_detail::is_lvalue_reference<T>
- , has_move_emulation_disabled<T>
- >
- >::type
- move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type &x) BOOST_NOEXCEPT
- {
- return x;
- }
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
- < rv<T>&
- , enable_move_utility_emulation<T>
- , ::boost::move_detail::is_not_rv<T>
- , ::boost::move_detail::and_
- < ::boost::move_detail::not_< ::boost::move_detail::is_lvalue_reference<T> >
- , has_move_emulation_enabled<T>
- >
- >::type
- move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type &x) BOOST_NOEXCEPT
- {
- return move(x);
- }
- }
- #else
- #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
- #include <utility>
- namespace boost{
- using ::std::move;
- using ::std::forward;
- }
- #else
- namespace boost {
-
-
-
-
-
-
- template<class T>
- struct enable_move_utility_emulation
- {
- static const bool value = false;
- };
-
-
-
-
-
- #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
-
-
-
-
- template <class T>
- rvalue_reference move(input_reference) noexcept;
- #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
-
- template <class T>
- BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
- { return t; }
- #else
- template <class T>
- BOOST_MOVE_INTRINSIC_CAST
- typename ::boost::move_detail::remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
- { return static_cast<typename ::boost::move_detail::remove_reference<T>::type &&>(t); }
- #endif
-
-
-
-
-
- #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
-
-
-
-
-
-
-
-
-
-
-
- template <class T> output_reference forward(input_reference) noexcept;
- #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
-
- template <class T>
- BOOST_MOVE_FORCEINLINE T&& forward(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT
- { return t; }
- #else
- template <class T>
- BOOST_MOVE_INTRINSIC_CAST
- T&& forward(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT
- { return static_cast<T&&>(t); }
- template <class T>
- BOOST_MOVE_INTRINSIC_CAST
- T&& forward(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
- {
-
- BOOST_MOVE_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
- return static_cast<T&&>(t);
- }
- #endif
- }
- #endif
-
-
-
-
-
- namespace boost {
- #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
-
-
- template <class T> output_reference move_if_not_lvalue_reference(input_reference) noexcept;
- #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
-
- template <class T>
- BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT
- { return t; }
- #else
- template <class T>
- BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT
- { return static_cast<T&&>(t); }
- template <class T>
- BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
- {
-
- BOOST_MOVE_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
- return static_cast<T&&>(t);
- }
- #endif
- }
- #endif
- #if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- namespace boost{
- namespace move_detail{
- template <typename T>
- typename boost::move_detail::add_rvalue_reference<T>::type declval();
- }
- }
- #endif
- #include <boost/move/detail/config_end.hpp>
- #endif
|