diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-05-12 13:12:33 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-05-12 13:12:33 (GMT) |
commit | b62e7979600feee23dc7cdb61042a8fc7673122b (patch) | |
tree | f7351372f37979dd2d048e0b68a16a4cd3b2aadb /contrib/src/boost/move | |
parent | 1b11b310be61e51b3ac5ebb83f7c8a33aef3d6e8 (diff) | |
download | uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.zip uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.gz uscxml-b62e7979600feee23dc7cdb61042a8fc7673122b.tar.bz2 |
Major Refactoring v2.0
Diffstat (limited to 'contrib/src/boost/move')
-rw-r--r-- | contrib/src/boost/move/algorithm.hpp | 282 | ||||
-rw-r--r-- | contrib/src/boost/move/core.hpp | 501 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/config_begin.hpp | 19 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/config_end.hpp | 12 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/iterator_traits.hpp | 73 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/meta_utils.hpp | 564 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/meta_utils_core.hpp | 120 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/std_ns_begin.hpp | 30 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/std_ns_end.hpp | 14 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/type_traits.hpp | 1078 | ||||
-rw-r--r-- | contrib/src/boost/move/detail/workaround.hpp | 55 | ||||
-rw-r--r-- | contrib/src/boost/move/iterator.hpp | 312 | ||||
-rw-r--r-- | contrib/src/boost/move/move.hpp | 35 | ||||
-rw-r--r-- | contrib/src/boost/move/traits.hpp | 77 | ||||
-rw-r--r-- | contrib/src/boost/move/utility.hpp | 149 | ||||
-rw-r--r-- | contrib/src/boost/move/utility_core.hpp | 317 |
16 files changed, 3638 insertions, 0 deletions
diff --git a/contrib/src/boost/move/algorithm.hpp b/contrib/src/boost/move/algorithm.hpp new file mode 100644 index 0000000..fbda0f4 --- /dev/null +++ b/contrib/src/boost/move/algorithm.hpp @@ -0,0 +1,282 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_ALGORITHM_HPP +#define BOOST_MOVE_ALGORITHM_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/utility_core.hpp> +#include <boost/move/iterator.hpp> +#include <boost/detail/no_exceptions_support.hpp> + +#include <algorithm> //copy, copy_backward +#include <memory> //uninitialized_copy + +namespace boost { + +////////////////////////////////////////////////////////////////////////////// +// +// move +// +////////////////////////////////////////////////////////////////////////////// + +#if !defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + + //! <b>Effects</b>: Moves elements in the range [first,last) into the range [result,result + (last - + //! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first), + //! performs *(result + n) = ::boost::move (*(first + n)). + //! + //! <b>Effects</b>: result + (last - first). + //! + //! <b>Requires</b>: result shall not be in the range [first,last). + //! + //! <b>Complexity</b>: Exactly last - first move assignments. + template <typename I, // I models InputIterator + typename O> // O models OutputIterator + O move(I f, I l, O result) + { + while (f != l) { + *result = ::boost::move(*f); + ++f; ++result; + } + return result; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // move_backward + // + ////////////////////////////////////////////////////////////////////////////// + + //! <b>Effects</b>: Moves elements in the range [first,last) into the range + //! [result - (last-first),result) starting from last - 1 and proceeding to + //! first. For each positive integer n <= (last - first), + //! performs *(result - n) = ::boost::move(*(last - n)). + //! + //! <b>Requires</b>: result shall not be in the range [first,last). + //! + //! <b>Returns</b>: result - (last - first). + //! + //! <b>Complexity</b>: Exactly last - first assignments. + template <typename I, // I models BidirectionalIterator + typename O> // O models BidirectionalIterator + O move_backward(I f, I l, O result) + { + while (f != l) { + --l; --result; + *result = ::boost::move(*l); + } + return result; + } + +#else + + using ::std::move_backward; + +#endif //!defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_move +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! new (static_cast<void*>(&*result)) +//! typename iterator_traits<ForwardIterator>::value_type(boost::move(*first)); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move(I f, I l, F r + /// @cond +// ,typename ::boost::move_detail::enable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0 + /// @endcond + ) +{ + typedef typename std::iterator_traits<I>::value_type input_value_type; + + F back = r; + BOOST_TRY{ + while (f != l) { + void * const addr = static_cast<void*>(::boost::move_detail::addressof(*r)); + ::new(addr) input_value_type(::boost::move(*f)); + ++f; ++r; + } + } + BOOST_CATCH(...){ + for (; back != r; ++back){ + back->~input_value_type(); + } + BOOST_RETHROW; + } + BOOST_CATCH_END + return r; +} + +/// @cond +/* +template + <typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move(I f, I l, F r, + typename ::boost::move_detail::disable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0) +{ + return std::uninitialized_copy(f, l, r); +} +*/ + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_or_move +// +////////////////////////////////////////////////////////////////////////////// + +namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_move_move_iterator(I f, I l, F r +// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0 +) +{ + return ::boost::uninitialized_move(f, l, r); +} +/* +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +F uninitialized_move_move_iterator(I f, I l, F r, + typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0) +{ + return std::uninitialized_copy(f.base(), l.base(), r); +} +*/ +} //namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_copy_or_move(I f, I l, F r, + typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r); +} + +////////////////////////////////////////////////////////////////////////////// +// +// copy_or_move +// +////////////////////////////////////////////////////////////////////////////// + +namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F move_move_iterator(I f, I l, F r +// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0 +) +{ + return ::boost::move(f, l, r); +} +/* +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +F move_move_iterator(I f, I l, F r, + typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0) +{ + return std::copy(f.base(), l.base(), r); +} +*/ + +} //namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F copy_or_move(I f, I l, F r, + typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::move_detail::move_move_iterator(f, l, r); +} + +/// @endcond + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! new (static_cast<void*>(&*result)) +//! typename iterator_traits<ForwardIterator>::value_type(*first); +//! \endcode +//! +//! <b>Returns</b>: result +//! +//! <b>Note</b>: This function is provided because +//! <i>std::uninitialized_copy</i> from some STL implementations +//! is not compatible with <i>move_iterator</i> +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_copy_or_move(I f, I l, F r + /// @cond + ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0 + /// @endcond + ) +{ + return std::uninitialized_copy(f, l, r); +} + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! *result = *first; +//! \endcode +//! +//! <b>Returns</b>: result +//! +//! <b>Note</b>: This function is provided because +//! <i>std::uninitialized_copy</i> from some STL implementations +//! is not compatible with <i>move_iterator</i> +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F copy_or_move(I f, I l, F r + /// @cond + ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0 + /// @endcond + ) +{ + return std::copy(f, l, r); +} + +} //namespace boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_ALGORITHM_HPP diff --git a/contrib/src/boost/move/core.hpp b/contrib/src/boost/move/core.hpp new file mode 100644 index 0000000..54aece0 --- /dev/null +++ b/contrib/src/boost/move/core.hpp @@ -0,0 +1,501 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file +//! This header implements macros to define movable classes and +//! move-aware functions + +#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> + +// @cond + +//boost_move_no_copy_constructor_or_assign typedef +//used to detect noncopyable types for other Boost libraries. +#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 //BOOST_NO_CXX11_DELETED_FUNCTIONS + +// @endcond + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + #include <boost/move/detail/type_traits.hpp> + + #if defined(BOOST_MOVE_ADDRESS_SANITIZER_ON) + #define BOOST_MOVE_TO_RV_CAST(RV_TYPE, ARG) reinterpret_cast<RV_TYPE>(ARG) + #else + #define BOOST_MOVE_TO_RV_CAST(RV_TYPE, ARG) static_cast<RV_TYPE>(ARG) + #endif + + //Move emulation rv breaks standard aliasing rules so add workarounds for some compilers + #if defined(__GNUC__) && (__GNUC__ >= 4) && \ + (\ + defined(BOOST_GCC) || \ + (defined(BOOST_INTEL) && (BOOST_INTEL_CXX_VERSION >= 1300)) \ + ) + #define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__)) + #else + #define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS + #endif + + namespace boost { + + ////////////////////////////////////////////////////////////////////////////// + // + // struct rv + // + ////////////////////////////////////////////////////////////////////////////// + template <class T> + class 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&); + } BOOST_MOVE_ATTRIBUTE_MAY_ALIAS; + + + ////////////////////////////////////////////////////////////////////////////// + // + // is_rv + // + ////////////////////////////////////////////////////////////////////////////// + + 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; + }; + + } //namespace move_detail { + + ////////////////////////////////////////////////////////////////////////////// + // + // has_move_emulation_enabled + // + ////////////////////////////////////////////////////////////////////////////// + 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; + }; + + } //namespace boost { + + #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> + inline 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> + inline 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> + inline 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; + } + + } //namespace move_detail { + } //namespace boost { + + #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)) + // + + ////////////////////////////////////////////////////////////////////////////// + // + // BOOST_MOVABLE_BUT_NOT_COPYABLE + // + ////////////////////////////////////////////////////////////////////////////// + #define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ + BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)\ + public:\ + operator ::boost::rv<TYPE>&() \ + { return *BOOST_MOVE_TO_RV_CAST(::boost::rv<TYPE>*, this); }\ + operator const ::boost::rv<TYPE>&() const \ + { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv<TYPE>*, this); }\ + private:\ + // + + ////////////////////////////////////////////////////////////////////////////// + // + // BOOST_COPYABLE_AND_MOVABLE + // + ////////////////////////////////////////////////////////////////////////////// + + #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ + public:\ + TYPE& operator=(TYPE &t)\ + { this->operator=(const_cast<const TYPE &>(t)); return *this;}\ + public:\ + operator ::boost::rv<TYPE>&() \ + { return *BOOST_MOVE_TO_RV_CAST(::boost::rv<TYPE>*, this); }\ + 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:\ + operator ::boost::rv<TYPE>&() \ + { return *BOOST_MOVE_TO_RV_CAST(::boost::rv<TYPE>*, this); }\ + 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 //BOOST_NO_CXX11_RVALUE_REFERENCES + + //! 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_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ + BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)\ + public:\ + typedef int boost_move_emulation_t;\ + // + + //! 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(TYPE)\ + // + + #if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\ + // + #endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + namespace boost { + + //!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. False otherwise. + 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; + }; + + } //namespace boost{ + + //!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(TYPE)\ + TYPE && \ + // + + //!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_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 expands to BOOST_RV_REF_BEG if BOOST_NO_CXX11_RVALUE_REFERENCES + //!is not defined, empty otherwise + #define BOOST_RV_REF_BEG_IF_CXX11 \ + BOOST_RV_REF_BEG \ + // + + //!This macro expands to BOOST_RV_REF_END if BOOST_NO_CXX11_RVALUE_REFERENCES + //!is not defined, empty otherwise + #define BOOST_RV_REF_END_IF_CXX11 \ + BOOST_RV_REF_END \ + // + + //!This macro is used to achieve portable syntax in copy + //!assignment for classes marked as BOOST_COPYABLE_AND_MOVABLE. + #define BOOST_COPY_ASSIGN_REF(TYPE)\ + const TYPE & \ + // + + //! This macro is used to implement portable perfect forwarding + //! as explained in the documentation. + #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_DOXYGEN_INVOKED) + + #if !defined(BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG) || defined(BOOST_MOVE_DOXYGEN_INVOKED) + + //!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: + //! <code>return BOOST_MOVE_RET(RET_TYPE, REF);</code> -> <code>return REF;</code> + //! + //!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. + //! + //! <b>Caution</b>: 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_MOVE_RET(RET_TYPE, REF)\ + REF + // + + #else //!defined(BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG) || defined(BOOST_MOVE_DOXYGEN_INVOKED) + + #include <boost/move/detail/meta_utils.hpp> + + namespace boost { + namespace move_detail { + + template <class Ret, class T> + inline 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> + inline 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); + } + + } //namespace move_detail { + } //namespace boost { + + #define BOOST_MOVE_RET(RET_TYPE, REF)\ + boost::move_detail::move_return< RET_TYPE >(REF) + // + + #endif //!defined(BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG) || defined(BOOST_MOVE_DOXYGEN_INVOKED) + + //!This macro is used to achieve portable optimal move constructors. + //! + //!When implementing the move constructor, in C++03 compilers the moved-from argument must be + //!cast to the base type before calling `::boost::move()` due to rvalue reference limitations. + //! + //!In C++11 compilers the cast from a rvalue reference of a derived type to a rvalue reference of + //!a base type is implicit. + #define BOOST_MOVE_BASE(BASE_TYPE, ARG) \ + ::boost::move((BASE_TYPE&)(ARG)) + // + + namespace boost { + namespace move_detail { + + template< class T> struct forward_type { typedef T type; }; + + }} + +#endif //BOOST_NO_CXX11_RVALUE_REFERENCES + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_CORE_HPP diff --git a/contrib/src/boost/move/detail/config_begin.hpp b/contrib/src/boost/move/detail/config_begin.hpp new file mode 100644 index 0000000..342390b --- /dev/null +++ b/contrib/src/boost/move/detail/config_begin.hpp @@ -0,0 +1,19 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONFIG_HPP +#include <boost/config.hpp> +#endif + +#ifdef BOOST_MSVC +# pragma warning (push) +# pragma warning (disable : 4324) // structure was padded due to __declspec(align()) +# pragma warning (disable : 4675) // "function": resolved overload was found by argument-dependent lookup +# pragma warning (disable : 4996) // "function": was declared deprecated (_CRT_SECURE_NO_DEPRECATE/_SCL_SECURE_NO_WARNINGS) +#endif diff --git a/contrib/src/boost/move/detail/config_end.hpp b/contrib/src/boost/move/detail/config_end.hpp new file mode 100644 index 0000000..71a99e9 --- /dev/null +++ b/contrib/src/boost/move/detail/config_end.hpp @@ -0,0 +1,12 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined BOOST_MSVC +# pragma warning (pop) +#endif diff --git a/contrib/src/boost/move/detail/iterator_traits.hpp b/contrib/src/boost/move/detail/iterator_traits.hpp new file mode 100644 index 0000000..a75ee03 --- /dev/null +++ b/contrib/src/boost/move/detail/iterator_traits.hpp @@ -0,0 +1,73 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2014. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP +#define BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include <cstddef> + +#include <boost/move/detail/std_ns_begin.hpp> +BOOST_MOVE_STD_NS_BEG + +struct input_iterator_tag; +struct forward_iterator_tag; +struct bidirectional_iterator_tag; +struct random_access_iterator_tag; +struct output_iterator_tag; + +BOOST_MOVE_STD_NS_END +#include <boost/move/detail/std_ns_end.hpp> + +namespace boost{ namespace movelib{ + +template<class Iterator> +struct iterator_traits +{ + typedef typename Iterator::difference_type difference_type; + typedef typename Iterator::value_type value_type; + typedef typename Iterator::pointer pointer; + typedef typename Iterator::reference reference; + typedef typename Iterator::iterator_category iterator_category; +}; + +template<class T> +struct iterator_traits<T*> +{ + typedef std::ptrdiff_t difference_type; + typedef T value_type; + typedef T* pointer; + typedef T& reference; + typedef std::random_access_iterator_tag iterator_category; +}; + +template<class T> +struct iterator_traits<const T*> +{ + typedef std::ptrdiff_t difference_type; + typedef T value_type; + typedef const T* pointer; + typedef const T& reference; + typedef std::random_access_iterator_tag iterator_category; +}; + +}} //namespace boost { namespace movelib{ + +#endif //#ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP diff --git a/contrib/src/boost/move/detail/meta_utils.hpp b/contrib/src/boost/move/detail/meta_utils.hpp new file mode 100644 index 0000000..323c13a --- /dev/null +++ b/contrib/src/boost/move/detail/meta_utils.hpp @@ -0,0 +1,564 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2015. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP +#define BOOST_MOVE_DETAIL_META_UTILS_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif +#include <boost/move/detail/meta_utils_core.hpp> +#include <cstddef> //for std::size_t + +//Small meta-typetraits to support move + +namespace boost { + +//Forward declare boost::rv +template <class T> class rv; + +namespace move_detail { + +////////////////////////////////////// +// is_different +////////////////////////////////////// +template<class T, class U> +struct is_different +{ + static const bool value = !is_same<T, U>::value; +}; + +////////////////////////////////////// +// apply +////////////////////////////////////// +template<class F, class Param> +struct apply +{ + typedef typename F::template apply<Param>::type type; +}; + +////////////////////////////////////// +// bool_ +////////////////////////////////////// + +template< bool C_ > +struct bool_ : integral_constant<bool, C_> +{ + operator bool() const { return C_; } + bool operator()() const { return C_; } +}; + +typedef bool_<true> true_; +typedef bool_<false> false_; + +////////////////////////////////////// +// nat +////////////////////////////////////// +struct nat{}; + +////////////////////////////////////// +// yes_type/no_type +////////////////////////////////////// +typedef char yes_type; + +struct no_type +{ + char _[2]; +}; + +////////////////////////////////////// +// natify +////////////////////////////////////// +template <class T> struct natify{}; + +////////////////////////////////////// +// remove_reference +////////////////////////////////////// +template<class T> +struct remove_reference +{ + typedef T type; +}; + +template<class T> +struct remove_reference<T&> +{ + typedef T type; +}; + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template<class T> +struct remove_reference<T&&> +{ + typedef T type; +}; + +#else + +template<class T> +struct remove_reference< rv<T> > +{ + typedef T type; +}; + +template<class T> +struct remove_reference< rv<T> &> +{ + typedef T type; +}; + +template<class T> +struct remove_reference< const rv<T> &> +{ + typedef T type; +}; + +#endif + +////////////////////////////////////// +// remove_pointer +////////////////////////////////////// + +template< class T > struct remove_pointer { typedef T type; }; +template< class T > struct remove_pointer<T*> { typedef T type; }; +template< class T > struct remove_pointer<T* const> { typedef T type; }; +template< class T > struct remove_pointer<T* volatile> { typedef T type; }; +template< class T > struct remove_pointer<T* const volatile> { typedef T type; }; + +////////////////////////////////////// +// add_pointer +////////////////////////////////////// +template< class T > +struct add_pointer +{ + typedef typename remove_reference<T>::type* type; +}; + +////////////////////////////////////// +// add_const +////////////////////////////////////// +template<class T> +struct add_const +{ + typedef const T type; +}; + +template<class T> +struct add_const<T&> +{ + typedef const T& type; +}; + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template<class T> +struct add_const<T&&> +{ + typedef T&& type; +}; + +#endif + +////////////////////////////////////// +// add_lvalue_reference +////////////////////////////////////// +template<class T> +struct add_lvalue_reference +{ typedef T& type; }; + +template<class T> struct add_lvalue_reference<T&> { typedef T& type; }; +template<> struct add_lvalue_reference<void> { typedef void type; }; +template<> struct add_lvalue_reference<const void> { typedef const void type; }; +template<> struct add_lvalue_reference<volatile void> { typedef volatile void type; }; +template<> struct add_lvalue_reference<const volatile void>{ typedef const volatile void type; }; + +template<class T> +struct add_const_lvalue_reference +{ + typedef typename remove_reference<T>::type t_unreferenced; + typedef typename add_const<t_unreferenced>::type t_unreferenced_const; + typedef typename add_lvalue_reference + <t_unreferenced_const>::type type; +}; + +////////////////////////////////////// +// is_lvalue_reference +////////////////////////////////////// +template<class T> +struct is_lvalue_reference +{ + static const bool value = false; +}; + +template<class T> +struct is_lvalue_reference<T&> +{ + static const bool value = true; +}; + + +////////////////////////////////////// +// identity +////////////////////////////////////// +template <class T> +struct identity +{ + typedef T type; + typedef typename add_const_lvalue_reference<T>::type reference; + reference operator()(reference t) + { return t; } +}; + +////////////////////////////////////// +// is_class_or_union +////////////////////////////////////// +template<class T> +struct is_class_or_union +{ + struct twochar { char dummy[2]; }; + template <class U> + static char is_class_or_union_tester(void(U::*)(void)); + template <class U> + static twochar is_class_or_union_tester(...); + static const bool value = sizeof(is_class_or_union_tester<T>(0)) == sizeof(char); +}; + +////////////////////////////////////// +// addressof +////////////////////////////////////// +template<class T> +struct addr_impl_ref +{ + T & v_; + inline addr_impl_ref( T & v ): v_( v ) {} + inline operator T& () const { return v_; } + + private: + addr_impl_ref & operator=(const addr_impl_ref &); +}; + +template<class T> +struct addressof_impl +{ + static inline T * f( T & v, long ) + { + return reinterpret_cast<T*>( + &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); + } + + static inline T * f( T * v, int ) + { return v; } +}; + +template<class T> +inline T * addressof( T & v ) +{ + return ::boost::move_detail::addressof_impl<T>::f + ( ::boost::move_detail::addr_impl_ref<T>( v ), 0 ); +} + +////////////////////////////////////// +// has_pointer_type +////////////////////////////////////// +template <class T> +struct has_pointer_type +{ + struct two { char c[2]; }; + template <class U> static two test(...); + template <class U> static char test(typename U::pointer* = 0); + static const bool value = sizeof(test<T>(0)) == 1; +}; + +////////////////////////////////////// +// is_convertible +////////////////////////////////////// +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + +//use intrinsic since in MSVC +//overaligned types can't go through ellipsis +template <class T, class U> +struct is_convertible +{ + static const bool value = __is_convertible_to(T, U); +}; + +#else + +template <class T, class U> +class is_convertible +{ + typedef typename add_lvalue_reference<T>::type t_reference; + typedef char true_t; + class false_t { char dummy[2]; }; + static false_t dispatch(...); + static true_t dispatch(U); + static t_reference trigger(); + public: + static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t); +}; + +#endif + +template< + bool C + , typename F1 + , typename F2 + > +struct eval_if_c + : if_c<C,F1,F2>::type +{}; + +template< + typename C + , typename T1 + , typename T2 + > +struct eval_if + : if_<C,T1,T2>::type +{}; + + +#if defined(BOOST_GCC) && (BOOST_GCC <= 40000) +#define BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN +#endif + +template<class T, class U, class R = void> +struct enable_if_convertible + : enable_if< is_convertible<T, U>, R> +{}; + +template<class T, class U, class R = void> +struct disable_if_convertible + : disable_if< is_convertible<T, U>, R> +{}; + +////////////////////////////////////////////////////////////////////////////// +// +// and_ +// +////////////////////////////////////////////////////////////////////////////// +template<bool, class B = true_, class C = true_, class D = true_> +struct and_impl + : and_impl<B::value, C, D> +{}; + +template<> +struct and_impl<true, true_, true_, true_> +{ + static const bool value = true; +}; + +template<class B, class C, class D> +struct and_impl<false, B, C, D> +{ + static const bool value = false; +}; + +template<class A, class B, class C = true_, class D = true_> +struct and_ + : and_impl<A::value, B, C, D> +{}; + +////////////////////////////////////////////////////////////////////////////// +// +// or_ +// +////////////////////////////////////////////////////////////////////////////// +template<bool, class B = false_, class C = false_, class D = false_> +struct or_impl + : or_impl<B::value, C, D> +{}; + +template<> +struct or_impl<false, false_, false_, false_> +{ + static const bool value = false; +}; + +template<class B, class C, class D> +struct or_impl<true, B, C, D> +{ + static const bool value = true; +}; + +template<class A, class B, class C = false_, class D = false_> +struct or_ + : or_impl<A::value, B, C, D> +{}; + +////////////////////////////////////////////////////////////////////////////// +// +// not_ +// +////////////////////////////////////////////////////////////////////////////// +template<class T> +struct not_ +{ + static const bool value = !T::value; +}; + +////////////////////////////////////////////////////////////////////////////// +// +// enable_if_and / disable_if_and / enable_if_or / disable_if_or +// +////////////////////////////////////////////////////////////////////////////// + +template<class R, class A, class B, class C = true_, class D = true_> +struct enable_if_and + : enable_if_c< and_<A, B, C, D>::value, R> +{}; + +template<class R, class A, class B, class C = true_, class D = true_> +struct disable_if_and + : disable_if_c< and_<A, B, C, D>::value, R> +{}; + +template<class R, class A, class B, class C = false_, class D = false_> +struct enable_if_or + : enable_if_c< or_<A, B, C, D>::value, R> +{}; + +template<class R, class A, class B, class C = false_, class D = false_> +struct disable_if_or + : disable_if_c< or_<A, B, C, D>::value, R> +{}; + +////////////////////////////////////////////////////////////////////////////// +// +// has_move_emulation_enabled_impl +// +////////////////////////////////////////////////////////////////////////////// +template<class T> +struct has_move_emulation_enabled_impl + : is_convertible< T, ::boost::rv<T>& > +{}; + +template<class T> +struct has_move_emulation_enabled_impl<T&> +{ static const bool value = false; }; + +template<class T> +struct has_move_emulation_enabled_impl< ::boost::rv<T> > +{ static const bool value = false; }; + +////////////////////////////////////////////////////////////////////////////// +// +// is_rv_impl +// +////////////////////////////////////////////////////////////////////////////// + +template <class T> +struct is_rv_impl +{ static const bool value = false; }; + +template <class T> +struct is_rv_impl< rv<T> > +{ static const bool value = true; }; + +template <class T> +struct is_rv_impl< const rv<T> > +{ static const bool value = true; }; + +// Code from Jeffrey Lee Hellrung, many thanks + +template< class T > +struct is_rvalue_reference +{ static const bool value = false; }; + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template< class T > +struct is_rvalue_reference< T&& > +{ static const bool value = true; }; + +#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template< class T > +struct is_rvalue_reference< boost::rv<T>& > +{ static const bool value = true; }; + +template< class T > +struct is_rvalue_reference< const boost::rv<T>& > +{ static const bool value = true; }; + +#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template< class T > +struct add_rvalue_reference +{ typedef T&& type; }; + +#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +namespace detail_add_rvalue_reference +{ + template< class T + , bool emulation = has_move_emulation_enabled_impl<T>::value + , bool rv = is_rv_impl<T>::value > + struct add_rvalue_reference_impl { typedef T type; }; + + template< class T, bool emulation> + struct add_rvalue_reference_impl< T, emulation, true > { typedef T & type; }; + + template< class T, bool rv > + struct add_rvalue_reference_impl< T, true, rv > { typedef ::boost::rv<T>& type; }; +} // namespace detail_add_rvalue_reference + +template< class T > +struct add_rvalue_reference + : detail_add_rvalue_reference::add_rvalue_reference_impl<T> +{ }; + +template< class T > +struct add_rvalue_reference<T &> +{ typedef T & type; }; + +#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template< class T > struct remove_rvalue_reference { typedef T type; }; + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template< class T > struct remove_rvalue_reference< T&& > { typedef T type; }; +#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template< class T > struct remove_rvalue_reference< rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< volatile rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const volatile rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< rv<T>& > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const rv<T>& > { typedef T type; }; + template< class T > struct remove_rvalue_reference< volatile rv<T>& > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const volatile rv<T>& >{ typedef T type; }; +#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +// Ideas from Boost.Move review, Jeffrey Lee Hellrung: +// +//- TypeTraits metafunctions is_lvalue_reference, add_lvalue_reference, and remove_lvalue_reference ? +// Perhaps add_reference and remove_reference can be modified so that they behave wrt emulated rvalue +// references the same as wrt real rvalue references, i.e., add_reference< rv<T>& > -> T& rather than +// rv<T>& (since T&& & -> T&). +// +//- Add'l TypeTraits has_[trivial_]move_{constructor,assign}...? +// +//- An as_lvalue(T& x) function, which amounts to an identity operation in C++0x, but strips emulated +// rvalue references in C++03. This may be necessary to prevent "accidental moves". + +} //namespace move_detail { +} //namespace boost { + +#endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP diff --git a/contrib/src/boost/move/detail/meta_utils_core.hpp b/contrib/src/boost/move/detail/meta_utils_core.hpp new file mode 100644 index 0000000..4d715a0 --- /dev/null +++ b/contrib/src/boost/move/detail/meta_utils_core.hpp @@ -0,0 +1,120 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP +#define BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +//Small meta-typetraits to support move + +namespace boost { +namespace move_detail { + +////////////////////////////////////// +// if_c +////////////////////////////////////// +template<bool C, typename T1, typename T2> +struct if_c +{ + typedef T1 type; +}; + +template<typename T1, typename T2> +struct if_c<false,T1,T2> +{ + typedef T2 type; +}; + +////////////////////////////////////// +// if_ +////////////////////////////////////// +template<typename T1, typename T2, typename T3> +struct if_ : if_c<0 != T1::value, T2, T3> +{}; + +////////////////////////////////////// +// enable_if_c +////////////////////////////////////// +template <bool B, class T = void> +struct enable_if_c +{ + typedef T type; +}; + +template <class T> +struct enable_if_c<false, T> {}; + +////////////////////////////////////// +// enable_if +////////////////////////////////////// +template <class Cond, class T = void> +struct enable_if : enable_if_c<Cond::value, T> {}; + +////////////////////////////////////// +// disable_if_c +////////////////////////////////////// +template <bool B, class T = void> +struct disable_if_c + : enable_if_c<!B, T> +{}; + +////////////////////////////////////// +// disable_if +////////////////////////////////////// +template <class Cond, class T = void> +struct disable_if : enable_if_c<!Cond::value, T> {}; + +////////////////////////////////////// +// integral_constant +////////////////////////////////////// +template<class T, T v> +struct integral_constant +{ + static const T value = v; + typedef T value_type; + typedef integral_constant<T, v> type; + + operator T() const { return value; } + T operator()() const { return value; } +}; + +typedef integral_constant<bool, true > true_type; +typedef integral_constant<bool, false > false_type; + + +////////////////////////////////////// +// is_same +////////////////////////////////////// +template<class T, class U> +struct is_same +{ + static const bool value = false; +}; + +template<class T> +struct is_same<T, T> +{ + static const bool value = true; +}; + +} //namespace move_detail { +} //namespace boost { + +#endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP diff --git a/contrib/src/boost/move/detail/std_ns_begin.hpp b/contrib/src/boost/move/detail/std_ns_begin.hpp new file mode 100644 index 0000000..a768e61 --- /dev/null +++ b/contrib/src/boost/move/detail/std_ns_begin.hpp @@ -0,0 +1,30 @@ +#////////////////////////////////////////////////////////////////////////////// +#// +#// (C) Copyright Ion Gaztanaga 2015-2015. +#// Distributed under the Boost Software License, Version 1.0. +#// (See accompanying file LICENSE_1_0.txt or copy at +#// http://www.boost.org/LICENSE_1_0.txt) +#// +#// See http://www.boost.org/libs/move for documentation. +#// +#////////////////////////////////////////////////////////////////////////////// +# +#if defined(_LIBCPP_VERSION) + #if defined(__clang__) + #define BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wc++11-extensions" + #endif + #define BOOST_MOVE_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD + #define BOOST_MOVE_STD_NS_END _LIBCPP_END_NAMESPACE_STD +#elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE_VERSION) //GCC >= 4.6 + #define BOOST_MOVE_STD_NS_BEG namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION + #define BOOST_MOVE_STD_NS_END _GLIBCXX_END_NAMESPACE_VERSION } // namespace +#elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE) //GCC >= 4.2 + #define BOOST_MOVE_STD_NS_BEG _GLIBCXX_BEGIN_NAMESPACE(std) + #define BOOST_MOVE_STD_NS_END _GLIBCXX_END_NAMESPACE +#else + #define BOOST_MOVE_STD_NS_BEG namespace std{ + #define BOOST_MOVE_STD_NS_END } +#endif + diff --git a/contrib/src/boost/move/detail/std_ns_end.hpp b/contrib/src/boost/move/detail/std_ns_end.hpp new file mode 100644 index 0000000..0975059 --- /dev/null +++ b/contrib/src/boost/move/detail/std_ns_end.hpp @@ -0,0 +1,14 @@ +#////////////////////////////////////////////////////////////////////////////// +#// +#// (C) Copyright Ion Gaztanaga 2015-2015. +#// Distributed under the Boost Software License, Version 1.0. +#// (See accompanying file LICENSE_1_0.txt or copy at +#// http://www.boost.org/LICENSE_1_0.txt) +#// +#// See http://www.boost.org/libs/move for documentation. +#// +#////////////////////////////////////////////////////////////////////////////// +#ifdef BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH + #pragma GCC diagnostic pop + #undef BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH +#endif //BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH diff --git a/contrib/src/boost/move/detail/type_traits.hpp b/contrib/src/boost/move/detail/type_traits.hpp new file mode 100644 index 0000000..816fdca --- /dev/null +++ b/contrib/src/boost/move/detail/type_traits.hpp @@ -0,0 +1,1078 @@ +////////////////////////////////////////////////////////////////////////////// +// (C) Copyright John Maddock 2000. +// (C) Copyright Ion Gaztanaga 2005-2015. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +// The alignment and Type traits implementation comes from +// John Maddock's TypeTraits library. +// +// Some other tricks come from Howard Hinnant's papers and StackOverflow replies +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_MOVE_DETAIL_TYPE_TRAITS_HPP +#define BOOST_MOVE_DETAIL_TYPE_TRAITS_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> + +// move/detail +#include <boost/move/detail/meta_utils.hpp> +// other +#include <boost/assert.hpp> +#include <boost/static_assert.hpp> +// std +#include <cstddef> + +//Use of Boost.TypeTraits leads to long preprocessed source code due to +//MPL dependencies. We'll use intrinsics directly and make or own +//simplified version of TypeTraits. +//If someday Boost.TypeTraits dependencies are minimized, we should +//revisit this file redirecting code to Boost.TypeTraits traits. + +//These traits don't care about volatile, reference or other checks +//made by Boost.TypeTraits because no volatile or reference types +//can be hold in Boost.Containers. This helps to avoid any Boost.TypeTraits +//dependency. + +// Helper macros for builtin compiler support. +// If your compiler has builtin support for any of the following +// traits concepts, then redefine the appropriate macros to pick +// up on the compiler support: +// +// (these should largely ignore cv-qualifiers) +// BOOST_MOVE_IS_POD(T) should evaluate to true if T is a POD type +// BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect +// BOOST_MOVE_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy +// BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) should evaluate to true if T(boost::move(t)) <==> memcpy +// BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy +// BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) should evaluate to true if t = boost::move(u) <==> memcpy +// BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect +// BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) should evaluate to true if "T x;" can not throw +// BOOST_MOVE_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw +// BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw +// BOOST_MOVE_IS_ENUM(T) should evaluate to true it t is a union type. +// +// The following can also be defined: when detected our implementation is greatly simplified. +// +// BOOST_ALIGNMENT_OF(T) should evaluate to the alignment requirements of type T. + +#if defined(__MSL_CPP__) && (__MSL_CPP__ >= 0x8000) + // Metrowerks compiler is acquiring intrinsic type traits support + // post version 8. We hook into the published interface to pick up + // user defined specializations as well as compiler intrinsics as + // and when they become available: +# include <msl_utility> +# define BOOST_MOVE_IS_UNION(T) BOOST_STD_EXTENSION_NAMESPACE::is_union<T>::value +# define BOOST_MOVE_IS_POD(T) BOOST_STD_EXTENSION_NAMESPACE::is_POD<T>::value +# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_default_ctor<T>::value +# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_copy_ctor<T>::value +# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_assignment<T>::value +# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) BOOST_STD_EXTENSION_NAMESPACE::has_trivial_dtor<T>::value +#endif + +#if (defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215))\ + || (defined(BOOST_INTEL) && defined(_MSC_VER) && (_MSC_VER >= 1500)) +# define BOOST_MOVE_IS_UNION(T) __is_union(T) +# define BOOST_MOVE_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T)) +# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T) +# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) +# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)|| ::boost::move_detail::is_pod<T>::value) +# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ::boost::move_detail::is_pod<T>::value) +# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::boost::move_detail::is_pod<T>::value) +# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::boost::move_detail::is_trivially_default_constructible<T>::value) +# define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) || ::boost::move_detail::is_trivially_copy_constructible<T>::value) +# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::boost::move_detail::is_trivially_copy_assignable<T>::value) + +# define BOOST_MOVE_IS_ENUM(T) __is_enum(T) +# if defined(_MSC_VER) && (_MSC_VER >= 1700) +# define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__has_trivial_move_constructor(T) || ::boost::move_detail::is_pod<T>::value) +# define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) (__has_trivial_move_assign(T) || ::boost::move_detail::is_pod<T>::value) +# endif +#endif + +#if defined(BOOST_CLANG) && defined(__has_feature) + +# if __has_feature(is_union) +# define BOOST_MOVE_IS_UNION(T) __is_union(T) +# endif +# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_pod) +# define BOOST_MOVE_IS_POD(T) __is_pod(T) +# endif +# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty) +# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T) +# endif +# if __has_feature(has_trivial_constructor) +# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) +# endif +# if __has_feature(has_trivial_copy) +# //There are problems with deleted copy constructors detected as trivially copyable. +# //http://stackoverflow.com/questions/12754886/has-trivial-copy-behaves-differently-in-clang-and-gcc-whos-right +# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && ::boost::move_detail::is_copy_constructible<T>::value) +# endif +# if __has_feature(has_trivial_assign) +# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) ) +# endif +# if __has_feature(has_trivial_destructor) +# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) +# endif +# if __has_feature(has_nothrow_constructor) +# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) +# endif +# if __has_feature(has_nothrow_copy) +# define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T)) +# endif +# if __has_feature(is_nothrow_copy_assignable) +# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T)) +# endif +# if __has_feature(is_enum) +# define BOOST_MOVE_IS_ENUM(T) __is_enum(T) +# endif +# if __has_feature(has_trivial_move_constructor) +# define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T) +# endif +# if __has_feature(has_trivial_move_assign) +# define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T) +# endif +# define BOOST_MOVE_ALIGNMENT_OF(T) __alignof(T) +#endif + +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG) + +#ifdef BOOST_INTEL +# define BOOST_MOVE_INTEL_TT_OPTS || ::boost::move_detail::is_pod<T>::value +#else +# define BOOST_MOVE_INTEL_TT_OPTS +#endif + +# define BOOST_MOVE_IS_UNION(T) __is_union(T) +# define BOOST_MOVE_IS_POD(T) __is_pod(T) +# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T) +# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_MOVE_INTEL_TT_OPTS)) +# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_MOVE_INTEL_TT_OPTS)) +# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_MOVE_INTEL_TT_OPTS) ) +# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_MOVE_INTEL_TT_OPTS) +# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_MOVE_INTEL_TT_OPTS) +# define BOOST_MOVE_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_MOVE_INTEL_TT_OPTS)) +# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_MOVE_INTEL_TT_OPTS)) + +# define BOOST_MOVE_IS_ENUM(T) __is_enum(T) +# if (!defined(unix) && !defined(__unix__)) || defined(__LP64__) + // GCC sometimes lies about alignment requirements + // of type double on 32-bit unix platforms, use the + // old implementation instead in that case: +# define BOOST_MOVE_ALIGNMENT_OF(T) __alignof__(T) +# endif +#endif + +#if defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600) + +# define BOOST_MOVE_IS_UNION(T) __is_union(T) +# define BOOST_MOVE_IS_POD(T) __is_pod(T) +# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T) +# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) +# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)) +# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T)) +# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) +# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) +# define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T)) +# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T)) + +# define BOOST_MOVE_IS_ENUM(T) __is_enum(T) +# define BOOST_MOVE_ALIGNMENT_OF(T) __alignof__(T) +#endif + +# if defined(__CODEGEARC__) +# define BOOST_MOVE_IS_UNION(T) __is_union(T) +# define BOOST_MOVE_IS_POD(T) __is_pod(T) +# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T) +# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T)) +# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T)) +# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T)) +# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T)) +# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T)) +# define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T)) +# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T)) + +# define BOOST_MOVE_IS_ENUM(T) __is_enum(T) +# define BOOST_MOVE_ALIGNMENT_OF(T) alignof(T) + +#endif + +//Fallback definitions + +#ifdef BOOST_MOVE_IS_UNION + #define BOOST_MOVE_IS_UNION_IMPL(T) BOOST_MOVE_IS_UNION(T) +#else + #define BOOST_MOVE_IS_UNION_IMPL(T) false +#endif + +#ifdef BOOST_MOVE_IS_POD + //in some compilers the intrinsic is limited to class types so add scalar and void + #define BOOST_MOVE_IS_POD_IMPL(T) (::boost::move_detail::is_scalar<T>::value ||\ + ::boost::move_detail::is_void<T>::value ||\ + BOOST_MOVE_IS_POD(T)) +#else + #define BOOST_MOVE_IS_POD_IMPL(T) \ + (::boost::move_detail::is_scalar<T>::value || ::boost::move_detail::is_void<T>::value) +#endif + +#ifdef BOOST_MOVE_IS_EMPTY + #define BOOST_MOVE_IS_EMPTY_IMPL(T) BOOST_MOVE_IS_EMPTY(T) +#else + #define BOOST_MOVE_IS_EMPTY_IMPL(T) ::boost::move_detail::is_empty_nonintrinsic<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_TRIVIAL_COPY + #define BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_COPY(T) +#else + #define BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR + #define BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) +#else + #define BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_TRIVIAL_COPY + #define BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_COPY(T) +#else + #define BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR + #define BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) +#else + #define BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_TRIVIAL_ASSIGN + #define BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T) BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) +#else + #define BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN + #define BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) +#else + #define BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR + #define BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) +#else + #define BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR + #define BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) +#else + #define BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_NOTHROW_COPY + #define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_COPY(T) +#else + #define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_NOTHROW_MOVE + #define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE(T) +#else + #define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_NOTHROW_ASSIGN + #define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) +#else + #define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN + #define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) +#else + #define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value +#endif + +#ifdef BOOST_MOVE_IS_ENUM + #define BOOST_MOVE_IS_ENUM_IMPL(T) BOOST_MOVE_IS_ENUM(T) +#else + #define BOOST_MOVE_IS_ENUM_IMPL(T) ::boost::move_detail::is_enum_nonintrinsic<T>::value +#endif + +namespace boost { +namespace move_detail { + +////////////////////////// +// is_reference +////////////////////////// +template<class T> +struct is_reference +{ static const bool value = false; }; + +template<class T> +struct is_reference<T&> +{ static const bool value = true; }; + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template<class T> +struct is_reference<T&&> +{ static const bool value = true; }; +#endif + +////////////////////////// +// is_pointer +////////////////////////// +template<class T> +struct is_pointer +{ static const bool value = false; }; + +template<class T> +struct is_pointer<T*> +{ static const bool value = true; }; + +////////////////////////// +// is_const +////////////////////////// +template<class T> +struct is_const +{ static const bool value = false; }; + +template<class T> +struct is_const<const T> +{ static const bool value = true; }; + +////////////////////////// +// unvoid_ref +////////////////////////// +template <typename T> struct unvoid_ref : add_lvalue_reference<T>{}; +template <> struct unvoid_ref<void> { typedef unvoid_ref & type; }; +template <> struct unvoid_ref<const void> { typedef unvoid_ref & type; }; +template <> struct unvoid_ref<volatile void> { typedef unvoid_ref & type; }; +template <> struct unvoid_ref<const volatile void> { typedef unvoid_ref & type; }; + +template <typename T> +struct add_reference : add_lvalue_reference<T> +{}; + +////////////////////////// +// add_const_reference +////////////////////////// +template <class T> +struct add_const_reference +{ typedef const T &type; }; + +template <class T> +struct add_const_reference<T&> +{ typedef T& type; }; + +////////////////////////// +// add_const_if_c +////////////////////////// +template<class T, bool Add> +struct add_const_if_c + : if_c<Add, typename add_const<T>::type, T> +{}; + +////////////////////////// +// remove_const +////////////////////////// +template<class T> +struct remove_const +{ typedef T type; }; + +template<class T> +struct remove_const< const T> +{ typedef T type; }; + +////////////////////////// +// remove_cv +////////////////////////// +template<typename T> struct remove_cv { typedef T type; }; +template<typename T> struct remove_cv<const T> { typedef T type; }; +template<typename T> struct remove_cv<const volatile T> { typedef T type; }; +template<typename T> struct remove_cv<volatile T> { typedef T type; }; + +////////////////////////// +// make_unsigned +////////////////////////// +template <class T> +struct make_unsigned_impl { typedef T type; }; +template <> struct make_unsigned_impl<signed char> { typedef unsigned char type; }; +template <> struct make_unsigned_impl<signed short> { typedef unsigned short type; }; +template <> struct make_unsigned_impl<signed int> { typedef unsigned int type; }; +template <> struct make_unsigned_impl<signed long> { typedef unsigned long type; }; +#ifdef BOOST_HAS_LONG_LONG +template <> struct make_unsigned_impl< ::boost::long_long_type > { typedef ::boost::ulong_long_type type; }; +#endif + +template <class T> +struct make_unsigned + : make_unsigned_impl<typename remove_cv<T>::type> +{}; + +////////////////////////// +// is_floating_point +////////////////////////// +template<class T> struct is_floating_point_cv { static const bool value = false; }; +template<> struct is_floating_point_cv<float> { static const bool value = true; }; +template<> struct is_floating_point_cv<double> { static const bool value = true; }; +template<> struct is_floating_point_cv<long double> { static const bool value = true; }; + +template<class T> +struct is_floating_point + : is_floating_point_cv<typename remove_cv<T>::type> +{}; + +////////////////////////// +// is_integral +////////////////////////// +template<class T> struct is_integral_cv { static const bool value = false; }; +template<> struct is_integral_cv< bool>{ static const bool value = true; }; +template<> struct is_integral_cv< char>{ static const bool value = true; }; +template<> struct is_integral_cv< unsigned char>{ static const bool value = true; }; +template<> struct is_integral_cv< signed char>{ static const bool value = true; }; +#ifndef BOOST_NO_CXX11_CHAR16_T +template<> struct is_integral_cv< char16_t>{ static const bool value = true; }; +#endif +#ifndef BOOST_NO_CXX11_CHAR32_T +template<> struct is_integral_cv< char32_t>{ static const bool value = true; }; +#endif +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<> struct is_integral_cv< wchar_t>{ static const bool value = true; }; +#endif +template<> struct is_integral_cv< short>{ static const bool value = true; }; +template<> struct is_integral_cv< unsigned short>{ static const bool value = true; }; +template<> struct is_integral_cv< int>{ static const bool value = true; }; +template<> struct is_integral_cv< unsigned int>{ static const bool value = true; }; +template<> struct is_integral_cv< long>{ static const bool value = true; }; +template<> struct is_integral_cv< unsigned long>{ static const bool value = true; }; +#ifdef BOOST_HAS_LONG_LONG +template<> struct is_integral_cv< ::boost:: long_long_type>{ static const bool value = true; }; +template<> struct is_integral_cv< ::boost::ulong_long_type>{ static const bool value = true; }; +#endif + +template<class T> +struct is_integral + : public is_integral_cv<typename remove_cv<T>::type> +{}; + +////////////////////////////////////// +// remove_all_extents +////////////////////////////////////// +template <class T> +struct remove_all_extents +{ typedef T type;}; + +template <class T> +struct remove_all_extents<T[]> +{ typedef typename remove_all_extents<T>::type type; }; + +template <class T, std::size_t N> +struct remove_all_extents<T[N]> +{ typedef typename remove_all_extents<T>::type type;}; + +////////////////////////// +// is_scalar +////////////////////////// +template<class T> +struct is_scalar +{ static const bool value = is_integral<T>::value || is_floating_point<T>::value; }; + +////////////////////////// +// is_void +////////////////////////// +template<class T> +struct is_void_cv +{ static const bool value = false; }; + +template<> +struct is_void_cv<void> +{ static const bool value = true; }; + +template<class T> +struct is_void + : is_void_cv<typename remove_cv<T>::type> +{}; + +////////////////////////////////////// +// is_array +////////////////////////////////////// +template<class T> +struct is_array +{ static const bool value = false; }; + +template<class T> +struct is_array<T[]> +{ static const bool value = true; }; + +template<class T, std::size_t N> +struct is_array<T[N]> +{ static const bool value = true; }; + +////////////////////////////////////// +// is_member_pointer +////////////////////////////////////// +template <class T> struct is_member_pointer_cv { static const bool value = false; }; +template <class T, class U>struct is_member_pointer_cv<T U::*> { static const bool value = true; }; + +template <class T> +struct is_member_pointer + : is_member_pointer_cv<typename remove_cv<T>::type> +{}; + +////////////////////////////////////// +// is_nullptr_t +////////////////////////////////////// +template <class T> +struct is_nullptr_t_cv +{ static const bool value = false; }; + +#if !defined(BOOST_NO_CXX11_NULLPTR) +template <> +struct is_nullptr_t_cv + #if !defined(BOOST_NO_CXX11_DECLTYPE) + <decltype(nullptr)> + #else + <std::nullptr_t> + #endif +{ static const bool value = true; }; +#endif + +template <class T> +struct is_nullptr_t + : is_nullptr_t_cv<typename remove_cv<T>::type> +{}; + +////////////////////////////////////// +// is_function +////////////////////////////////////// +//Inspired by libc++, thanks to Howard Hinnant +//For a function to pointer an lvalue of function type T can be implicitly converted to a prvalue +//pointer to that function. This does not apply to non-static member functions because lvalues +//that refer to non-static member functions do not exist. +template <class T> +struct is_reference_convertible_to_pointer +{ + struct twochar { char dummy[2]; }; + template <class U> static char test(U*); + template <class U> static twochar test(...); + static T& source(); + static const bool value = sizeof(char) == sizeof(test<T>(source())); +}; +//Filter out: +// - class types that might have implicit conversions +// - void (to avoid forming a reference to void later) +// - references (e.g.: filtering reference to functions) +// - nullptr_t (convertible to pointer) +template < class T + , bool Filter = is_class_or_union<T>::value || + is_void<T>::value || + is_reference<T>::value || + is_nullptr_t<T>::value > +struct is_function_impl +{ static const bool value = is_reference_convertible_to_pointer<T>::value; }; + +template <class T> +struct is_function_impl<T, true> +{ static const bool value = false; }; + +template <class T> +struct is_function + : is_function_impl<T> +{}; + +////////////////////////////////////// +// is_union +////////////////////////////////////// +template<class T> +struct is_union_noextents_cv +{ static const bool value = BOOST_MOVE_IS_UNION_IMPL(T); }; + +template<class T> +struct is_union + : is_union_noextents_cv<typename remove_cv<typename remove_all_extents<T>::type>::type> +{}; + +////////////////////////////////////// +// is_class +////////////////////////////////////// +template <class T> +struct is_class +{ + static const bool value = is_class_or_union<T>::value && ! is_union<T>::value; +}; + + +////////////////////////////////////// +// is_arithmetic +////////////////////////////////////// +template <class T> +struct is_arithmetic +{ + static const bool value = is_floating_point<T>::value || + is_integral<T>::value; +}; + +////////////////////////////////////// +// is_member_function_pointer +////////////////////////////////////// +template <class T> +struct is_member_function_pointer_cv +{ + static const bool value = false; +}; + +template <class T, class C> +struct is_member_function_pointer_cv<T C::*> + : is_function<T> +{}; + +template <class T> +struct is_member_function_pointer + : is_member_function_pointer_cv<typename remove_cv<T>::type> +{}; + +////////////////////////////////////// +// is_enum +////////////////////////////////////// +#if !defined(BOOST_MOVE_IS_ENUM) +//Based on (http://howardhinnant.github.io/TypeHiearchy.pdf) +template <class T> +struct is_enum_nonintrinsic +{ + static const bool value = !is_arithmetic<T>::value && + !is_reference<T>::value && + !is_class_or_union<T>::value && + !is_array<T>::value && + !is_void<T>::value && + !is_nullptr_t<T>::value && + !is_member_pointer<T>::value && + !is_pointer<T>::value && + !is_function<T>::value; +}; +#endif + +template <class T> +struct is_enum +{ static const bool value = BOOST_MOVE_IS_ENUM_IMPL(T); }; + +////////////////////////////////////// +// is_pod +////////////////////////////////////// +template<class T> +struct is_pod_noextents_cv //for non-c++11 compilers, a safe fallback +{ static const bool value = BOOST_MOVE_IS_POD_IMPL(T); }; + +template<class T> +struct is_pod + : is_pod_noextents_cv<typename remove_cv<typename remove_all_extents<T>::type>::type> +{}; + +////////////////////////////////////// +// is_empty +////////////////////////////////////// +#if !defined(BOOST_MOVE_IS_EMPTY) + +template <typename T> +struct empty_helper_t1 : public T +{ + empty_helper_t1(); // hh compiler bug workaround + int i[256]; + private: + + empty_helper_t1(const empty_helper_t1&); + empty_helper_t1& operator=(const empty_helper_t1&); +}; + +struct empty_helper_t2 { int i[256]; }; + +template <typename T, bool IsClass = is_class<T>::value > +struct is_empty_nonintrinsic +{ + static const bool value = false; +}; + +template <typename T> +struct is_empty_nonintrinsic<T, true> +{ + static const bool value = sizeof(empty_helper_t1<T>) == sizeof(empty_helper_t2); +}; +#endif + +template <class T> +struct is_empty +{ static const bool value = BOOST_MOVE_IS_EMPTY_IMPL(T); }; + + +template<class T> +struct has_boost_move_no_copy_constructor_or_assign_type +{ + template <class U> + static yes_type test(typename U::boost_move_no_copy_constructor_or_assign*); + + template <class U> + static no_type test(...); + + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); +}; + +////////////////////////////////////// +// is_copy_constructible +////////////////////////////////////// +#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_CXX11_DECLTYPE) \ + && !defined(BOOST_INTEL_CXX_VERSION) && \ + !(defined(BOOST_MSVC) && _MSC_VER == 1800) +#define BOOST_MOVE_TT_CXX11_IS_COPY_CONSTRUCTIBLE +#endif + +template<class T> +struct is_copy_constructible +{ + // Intel compiler has problems with SFINAE for copy constructors and deleted functions: + // + // error: function *function_name* cannot be referenced -- it is a deleted function + // static yes_type test(U&, decltype(U(boost::declval<U&>()))* = 0); + // ^ + // MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: + // https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken + #if defined(BOOST_MOVE_TT_CXX11_IS_COPY_CONSTRUCTIBLE) + template<class U> static typename add_reference<U>::type source(); + static no_type test(...); + #ifdef BOOST_NO_CXX11_DECLTYPE + template <class U> + static yes_type test(U&, bool_<sizeof(U(source<U>()))>* = 0); + #else + template <class U> + static yes_type test(U&, decltype(U(source<U>()))* = 0); + #endif + static const bool value = sizeof(test(source<T>())) == sizeof(yes_type); + #else + static const bool value = !has_boost_move_no_copy_constructor_or_assign_type<T>::value; + #endif +}; + + +////////////////////////////////////// +// is_copy_assignable +////////////////////////////////////// +#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_CXX11_DECLTYPE) \ + && !defined(BOOST_INTEL_CXX_VERSION) && \ + !(defined(BOOST_MSVC) && _MSC_VER == 1800) +#define BOOST_MOVE_TT_CXX11_IS_COPY_ASSIGNABLE +#endif + +template <class T> +struct is_copy_assignable +{ +// Intel compiler has problems with SFINAE for copy constructors and deleted functions: +// +// error: function *function_name* cannot be referenced -- it is a deleted function +// static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval<T1&>()))* = 0); +// ^ +// +// MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See: +// https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken +#if defined(BOOST_MOVE_TT_CXX11_IS_COPY_ASSIGNABLE) + typedef char yes_type; + struct no_type { char dummy[2]; }; + + template <class U> static typename add_reference<U>::type source(); + template <class U> static decltype(source<U&>() = source<const U&>(), yes_type() ) test(int); + template <class> static no_type test(...); + + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); +#else + static const bool value = !has_boost_move_no_copy_constructor_or_assign_type<T>::value; +#endif +}; + +////////////////////////////////////// +// is_trivially_destructible +////////////////////////////////////// +template<class T> +struct is_trivially_destructible +{ static const bool value = BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T); }; + +////////////////////////////////////// +// is_trivially_default_constructible +////////////////////////////////////// +template<class T> +struct is_trivially_default_constructible +{ static const bool value = BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T); }; + +////////////////////////////////////// +// is_trivially_copy_constructible +////////////////////////////////////// +template<class T> +struct is_trivially_copy_constructible +{ + //In several compilers BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE return true even with + //deleted copy constructors so make sure the type is copy constructible. + static const bool value = ::boost::move_detail::is_pod<T>::value || + ( ::boost::move_detail::is_copy_constructible<T>::value && + BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T) ); +}; + +////////////////////////////////////// +// is_trivially_move_constructible +////////////////////////////////////// +template<class T> +struct is_trivially_move_constructible +{ static const bool value = BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T); }; + +////////////////////////////////////// +// is_trivially_copy_assignable +////////////////////////////////////// +template<class T> +struct is_trivially_copy_assignable +{ + //In several compilers BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE return true even with + //deleted copy constructors so make sure the type is copy constructible. + static const bool value = ::boost::move_detail::is_pod<T>::value || + ( ::boost::move_detail::is_copy_assignable<T>::value && + BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T) ); +}; + +////////////////////////////////////// +// is_trivially_move_assignable +////////////////////////////////////// +template<class T> +struct is_trivially_move_assignable +{ static const bool value = BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T); }; + +////////////////////////////////////// +// is_nothrow_default_constructible +////////////////////////////////////// +template<class T> +struct is_nothrow_default_constructible + : is_pod<T> +{ static const bool value = BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T); }; + +////////////////////////////////////// +// is_nothrow_copy_constructible +////////////////////////////////////// +template<class T> +struct is_nothrow_copy_constructible +{ static const bool value = BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T); }; + +////////////////////////////////////// +// is_nothrow_move_constructible +////////////////////////////////////// +template<class T> +struct is_nothrow_move_constructible +{ static const bool value = BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T); }; + +////////////////////////////////////// +// is_nothrow_copy_assignable +////////////////////////////////////// +template<class T> +struct is_nothrow_copy_assignable +{ static const bool value = BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T); }; + +////////////////////////////////////// +// is_nothrow_move_assignable +////////////////////////////////////// +template<class T> +struct is_nothrow_move_assignable +{ static const bool value = BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T); }; + +////////////////////////////////////// +// is_nothrow_swappable +////////////////////////////////////// +template<class T> +struct is_nothrow_swappable +{ + static const bool value = is_empty<T>::value || is_pod<T>::value; +}; + +////////////////////////////////////// +// alignment_of +////////////////////////////////////// +template <typename T> +struct alignment_of_hack +{ + T t1; + char c; + T t2; + alignment_of_hack(); +}; + +template <unsigned A, unsigned S> +struct alignment_logic +{ static const std::size_t value = A < S ? A : S; }; + +template< typename T > +struct alignment_of_impl +#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) + // With MSVC both the native __alignof operator + // and our own logic gets things wrong from time to time :-( + // Using a combination of the two seems to make the most of a bad job: + : alignment_logic< sizeof(alignment_of_hack<T>) - 2*sizeof(T), __alignof(T)> +{}; +#elif !defined(BOOST_MOVE_ALIGNMENT_OF) + : alignment_logic< sizeof(alignment_of_hack<T>) - 2*sizeof(T), sizeof(T)> +{}; +#else +{ static const std::size_t value = BOOST_MOVE_ALIGNMENT_OF(T); }; +#endif + +template< typename T > +struct alignment_of + : alignment_of_impl<T> +{}; + +class alignment_dummy; +typedef void (*function_ptr)(); +typedef int (alignment_dummy::*member_ptr); +typedef int (alignment_dummy::*member_function_ptr)(); +struct alignment_struct +{ long double dummy[4]; }; + +///////////////////////////// +// max_align_t +///////////////////////////// +//This is not standard, but should work with all compilers +union max_align +{ + char char_; + short short_; + int int_; + long long_; + #ifdef BOOST_HAS_LONG_LONG + ::boost::long_long_type long_long_; + #endif + float float_; + double double_; + void * void_ptr_; + long double long_double_[4]; + alignment_dummy *unknown_class_ptr_; + function_ptr function_ptr_; + member_function_ptr member_function_ptr_; + alignment_struct alignment_struct_; +}; + +typedef union max_align max_align_t; + +///////////////////////////// +// aligned_storage +///////////////////////////// + +#if !defined(BOOST_NO_ALIGNMENT) + +template<std::size_t Len, std::size_t Align> +struct aligned_storage_impl; + +#define BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(A)\ +template<std::size_t Len>\ +struct BOOST_ALIGNMENT(A) aligned_storage_impl<Len, A>\ +{\ + char dummy[Len];\ + typedef aligned_storage_impl<Len, A> type;\ +};\ +// + +//Up to 4K alignment (typical page size) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x1) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x2) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x4) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x8) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x10) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x20) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x40) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x80) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x100) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x200) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x400) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x800) +BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x1000) + +#undef BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT + +#else //BOOST_NO_ALIGNMENT + +template<class T, std::size_t Len> +union aligned_union +{ + T aligner; + char dummy[Len]; +}; + +template<std::size_t Len, std::size_t Align, class T, bool Ok> +struct aligned_next; + +template<std::size_t Len, std::size_t Align, class T> +struct aligned_next<Len, Align, T, true> +{ + BOOST_STATIC_ASSERT((alignment_of<T>::value == Align)); + typedef aligned_union<T, Len> type; +}; + +//End of search defaults to max_align_t +template<std::size_t Len, std::size_t Align> +struct aligned_next<Len, Align, max_align_t, false> +{ typedef aligned_union<max_align_t, Len> type; }; + +//Now define a search list through types +#define BOOST_MOVE_ALIGNED_NEXT_STEP(TYPE, NEXT_TYPE)\ + template<std::size_t Len, std::size_t Align>\ + struct aligned_next<Len, Align, TYPE, false>\ + : aligned_next<Len, Align, NEXT_TYPE, Align == alignment_of<NEXT_TYPE>::value>\ + {};\ + // + BOOST_MOVE_ALIGNED_NEXT_STEP(long double, max_align_t) + BOOST_MOVE_ALIGNED_NEXT_STEP(double, long double) + #ifdef BOOST_HAS_LONG_LONG + BOOST_MOVE_ALIGNED_NEXT_STEP(::boost::long_long_type, double) + BOOST_MOVE_ALIGNED_NEXT_STEP(long, ::boost::long_long_type) + #else + BOOST_MOVE_ALIGNED_NEXT_STEP(long, double) + #endif + BOOST_MOVE_ALIGNED_NEXT_STEP(int, long) + BOOST_MOVE_ALIGNED_NEXT_STEP(short, int) + BOOST_MOVE_ALIGNED_NEXT_STEP(char, short) +#undef BOOST_MOVE_ALIGNED_NEXT_STEP + +template<std::size_t Len, std::size_t Align> +struct aligned_storage_impl + : aligned_next<Len, Align, char, Align == alignment_of<char>::value> +{}; + +#endif + +template<std::size_t Len, std::size_t Align = alignment_of<max_align_t>::value> +struct aligned_storage +{ + //Sanity checks for input parameters + BOOST_STATIC_ASSERT(Align > 0); + + //Sanity checks for output type + typedef typename aligned_storage_impl<Len ? Len : 1, Align>::type type; + static const std::size_t value = alignment_of<type>::value; + BOOST_STATIC_ASSERT(value >= Align); + BOOST_STATIC_ASSERT((value % Align) == 0); + + //Just in case someone instantiates aligned_storage + //instead of aligned_storage::type (typical error). + private: + aligned_storage(); +}; + +} //namespace move_detail { +} //namespace boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_DETAIL_TYPE_TRAITS_HPP diff --git a/contrib/src/boost/move/detail/workaround.hpp b/contrib/src/boost/move/detail/workaround.hpp new file mode 100644 index 0000000..b3f81b1 --- /dev/null +++ b/contrib/src/boost/move/detail/workaround.hpp @@ -0,0 +1,55 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2014. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP +#define BOOST_MOVE_DETAIL_WORKAROUND_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + #define BOOST_MOVE_PERFECT_FORWARDING +#endif + +#if defined(__has_feature) + #define BOOST_MOVE_HAS_FEATURE __has_feature +#else + #define BOOST_MOVE_HAS_FEATURE(x) 0 +#endif + +#if BOOST_MOVE_HAS_FEATURE(address_sanitizer) || defined(__SANITIZE_ADDRESS__) + #define BOOST_MOVE_ADDRESS_SANITIZER_ON +#endif + +//Macros for documentation purposes. For code, expands to the argument +#define BOOST_MOVE_IMPDEF(TYPE) TYPE +#define BOOST_MOVE_SEEDOC(TYPE) TYPE +#define BOOST_MOVE_DOC0PTR(TYPE) TYPE +#define BOOST_MOVE_DOC1ST(TYPE1, TYPE2) TYPE2 +#define BOOST_MOVE_I , +#define BOOST_MOVE_DOCIGN(T1) T1 + +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) && !defined(__clang__) + //Pre-standard rvalue binding rules + #define BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES +#elif defined(_MSC_VER) && (_MSC_VER == 1600) + //Standard rvalue binding rules but with some bugs + #define BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG + #define BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG +#elif defined(_MSC_VER) && (_MSC_VER == 1700) + #define BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG +#endif + +#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP diff --git a/contrib/src/boost/move/iterator.hpp b/contrib/src/boost/move/iterator.hpp new file mode 100644 index 0000000..1b39e26 --- /dev/null +++ b/contrib/src/boost/move/iterator.hpp @@ -0,0 +1,312 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_ITERATOR_HPP +#define BOOST_MOVE_ITERATOR_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/iterator_traits.hpp> +#include <boost/move/utility_core.hpp> + +namespace boost { + +////////////////////////////////////////////////////////////////////////////// +// +// move_iterator +// +////////////////////////////////////////////////////////////////////////////// + +//! Class template move_iterator is an iterator adaptor with the same behavior +//! as the underlying iterator except that its dereference operator implicitly +//! converts the value returned by the underlying iterator's dereference operator +//! to an rvalue reference. Some generic algorithms can be called with move +//! iterators to replace copying with moving. +template <class It> +class move_iterator +{ + public: + typedef It iterator_type; + typedef typename boost::movelib::iterator_traits<iterator_type>::value_type value_type; + #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED) + typedef value_type && reference; + #else + typedef typename ::boost::move_detail::if_ + < ::boost::has_move_emulation_enabled<value_type> + , ::boost::rv<value_type>& + , value_type & >::type reference; + #endif + typedef It pointer; + typedef typename boost::movelib::iterator_traits<iterator_type>::difference_type difference_type; + typedef typename boost::movelib::iterator_traits<iterator_type>::iterator_category iterator_category; + + move_iterator() + {} + + explicit move_iterator(It i) + : m_it(i) + {} + + template <class U> + move_iterator(const move_iterator<U>& u) + : m_it(u.base()) + {} + + iterator_type base() const + { return m_it; } + + reference operator*() const + { + #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + return *m_it; + #else + return ::boost::move(*m_it); + #endif + } + + pointer operator->() const + { return m_it; } + + move_iterator& operator++() + { ++m_it; return *this; } + + move_iterator<iterator_type> operator++(int) + { move_iterator<iterator_type> tmp(*this); ++(*this); return tmp; } + + move_iterator& operator--() + { --m_it; return *this; } + + move_iterator<iterator_type> operator--(int) + { move_iterator<iterator_type> tmp(*this); --(*this); return tmp; } + + move_iterator<iterator_type> operator+ (difference_type n) const + { return move_iterator<iterator_type>(m_it + n); } + + move_iterator& operator+=(difference_type n) + { m_it += n; return *this; } + + move_iterator<iterator_type> operator- (difference_type n) const + { return move_iterator<iterator_type>(m_it - n); } + + move_iterator& operator-=(difference_type n) + { m_it -= n; return *this; } + + reference operator[](difference_type n) const + { + #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + return m_it[n]; + #else + return ::boost::move(m_it[n]); + #endif + } + + friend bool operator==(const move_iterator& x, const move_iterator& y) + { return x.base() == y.base(); } + + friend bool operator!=(const move_iterator& x, const move_iterator& y) + { return x.base() != y.base(); } + + friend bool operator< (const move_iterator& x, const move_iterator& y) + { return x.base() < y.base(); } + + friend bool operator<=(const move_iterator& x, const move_iterator& y) + { return x.base() <= y.base(); } + + friend bool operator> (const move_iterator& x, const move_iterator& y) + { return x.base() > y.base(); } + + friend bool operator>=(const move_iterator& x, const move_iterator& y) + { return x.base() >= y.base(); } + + friend difference_type operator-(const move_iterator& x, const move_iterator& y) + { return x.base() - y.base(); } + + friend move_iterator operator+(difference_type n, const move_iterator& x) + { return move_iterator(x.base() + n); } + + private: + It m_it; +}; + +//is_move_iterator +namespace move_detail { + +template <class I> +struct is_move_iterator +{ + static const bool value = false; +}; + +template <class I> +struct is_move_iterator< ::boost::move_iterator<I> > +{ + static const bool value = true; +}; + +} //namespace move_detail { + +////////////////////////////////////////////////////////////////////////////// +// +// move_iterator +// +////////////////////////////////////////////////////////////////////////////// + +//! +//! <b>Returns</b>: move_iterator<It>(i). +template<class It> +inline move_iterator<It> make_move_iterator(const It &it) +{ return move_iterator<It>(it); } + +////////////////////////////////////////////////////////////////////////////// +// +// back_move_insert_iterator +// +////////////////////////////////////////////////////////////////////////////// + + +//! A move insert iterator that move constructs elements at the +//! back of a container +template <typename C> // C models Container +class back_move_insert_iterator +{ + C* container_m; + + public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + typedef typename C::pointer pointer; + typedef typename C::difference_type difference_type; + typedef std::output_iterator_tag iterator_category; + + explicit back_move_insert_iterator(C& x) : container_m(&x) { } + + back_move_insert_iterator& operator=(reference x) + { container_m->push_back(boost::move(x)); return *this; } + + back_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x) + { reference rx = x; return this->operator=(rx); } + + back_move_insert_iterator& operator*() { return *this; } + back_move_insert_iterator& operator++() { return *this; } + back_move_insert_iterator& operator++(int) { return *this; } +}; + +//! +//! <b>Returns</b>: back_move_insert_iterator<C>(x). +template <typename C> // C models Container +inline back_move_insert_iterator<C> back_move_inserter(C& x) +{ + return back_move_insert_iterator<C>(x); +} + +////////////////////////////////////////////////////////////////////////////// +// +// front_move_insert_iterator +// +////////////////////////////////////////////////////////////////////////////// + +//! A move insert iterator that move constructs elements int the +//! front of a container +template <typename C> // C models Container +class front_move_insert_iterator +{ + C* container_m; + +public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + typedef typename C::pointer pointer; + typedef typename C::difference_type difference_type; + typedef std::output_iterator_tag iterator_category; + + explicit front_move_insert_iterator(C& x) : container_m(&x) { } + + front_move_insert_iterator& operator=(reference x) + { container_m->push_front(boost::move(x)); return *this; } + + front_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x) + { reference rx = x; return this->operator=(rx); } + + front_move_insert_iterator& operator*() { return *this; } + front_move_insert_iterator& operator++() { return *this; } + front_move_insert_iterator& operator++(int) { return *this; } +}; + +//! +//! <b>Returns</b>: front_move_insert_iterator<C>(x). +template <typename C> // C models Container +inline front_move_insert_iterator<C> front_move_inserter(C& x) +{ + return front_move_insert_iterator<C>(x); +} + +////////////////////////////////////////////////////////////////////////////// +// +// insert_move_iterator +// +////////////////////////////////////////////////////////////////////////////// +template <typename C> // C models Container +class move_insert_iterator +{ + C* container_m; + typename C::iterator pos_; + + public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + typedef typename C::pointer pointer; + typedef typename C::difference_type difference_type; + typedef std::output_iterator_tag iterator_category; + + explicit move_insert_iterator(C& x, typename C::iterator pos) + : container_m(&x), pos_(pos) + {} + + move_insert_iterator& operator=(reference x) + { + pos_ = container_m->insert(pos_, ::boost::move(x)); + ++pos_; + return *this; + } + + move_insert_iterator& operator=(BOOST_RV_REF(value_type) x) + { reference rx = x; return this->operator=(rx); } + + move_insert_iterator& operator*() { return *this; } + move_insert_iterator& operator++() { return *this; } + move_insert_iterator& operator++(int) { return *this; } +}; + +//! +//! <b>Returns</b>: move_insert_iterator<C>(x, it). +template <typename C> // C models Container +inline move_insert_iterator<C> move_inserter(C& x, typename C::iterator it) +{ + return move_insert_iterator<C>(x, it); +} + +} //namespace boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_ITERATOR_HPP diff --git a/contrib/src/boost/move/move.hpp b/contrib/src/boost/move/move.hpp new file mode 100644 index 0000000..62dddbc --- /dev/null +++ b/contrib/src/boost/move/move.hpp @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright David Abrahams, Vicente Botet 2009. +// (C) Copyright Ion Gaztanaga 2009-2012. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file +//! A general library header that includes +//! the rest of top-level headers. + +#ifndef BOOST_MOVE_MOVE_HPP +#define BOOST_MOVE_MOVE_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/utility.hpp> +#include <boost/move/iterator.hpp> +#include <boost/move/traits.hpp> +#include <boost/move/algorithm.hpp> +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_MOVE_HPP diff --git a/contrib/src/boost/move/traits.hpp b/contrib/src/boost/move/traits.hpp new file mode 100644 index 0000000..b48b8f6 --- /dev/null +++ b/contrib/src/boost/move/traits.hpp @@ -0,0 +1,77 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2009-2012. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_TRAITS_HPP +#define BOOST_MOVE_TRAITS_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> + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#include <boost/move/core.hpp> +#endif +#include <boost/move/detail/meta_utils.hpp> +#include <boost/move/detail/type_traits.hpp> + +namespace boost { + +//! If this trait yields to true +//! (<i>has_trivial_destructor_after_move <T>::value == true</i>) +//! means that if T is used as argument of a move construction/assignment, +//! there is no need to call T's destructor. +//! This optimization tipically is used to improve containers' performance. +//! +//! By default this trait is true if the type has trivial destructor, +//! every class should specialize this trait if it wants to improve performance +//! when inserted in containers. +template <class T> +struct has_trivial_destructor_after_move + : ::boost::move_detail::is_trivially_destructible<T> +{}; + +//! By default this traits returns +//! <pre>boost::is_nothrow_move_constructible<T>::value && boost::is_nothrow_move_assignable<T>::value </pre>. +//! Classes with non-throwing move constructor +//! and assignment can specialize this trait to obtain some performance improvements. +template <class T> +struct has_nothrow_move +{ + static const bool value = boost::move_detail::is_nothrow_move_constructible<T>::value && + boost::move_detail::is_nothrow_move_assignable<T>::value; +}; + +namespace move_detail { + +template <class T> +struct is_nothrow_move_constructible_or_uncopyable +{ + //The standard requires is_nothrow_move_constructible for move_if_noexcept + //but a user (usually in C++03) might specialize has_nothrow_move which includes it + static const bool value = is_nothrow_move_constructible<T>::value || + has_nothrow_move<T>::value || + !is_copy_constructible<T>::value; +}; + +} //move_detail { +} //namespace boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_TRAITS_HPP diff --git a/contrib/src/boost/move/utility.hpp b/contrib/src/boost/move/utility.hpp new file mode 100644 index 0000000..8f9c20b --- /dev/null +++ b/contrib/src/boost/move/utility.hpp @@ -0,0 +1,149 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file +//! This header includes core utilities from <tt><boost/move/utility_core.hpp></tt> and defines +//! some more advanced utilities such as: + +#ifndef BOOST_MOVE_MOVE_UTILITY_HPP +#define BOOST_MOVE_MOVE_UTILITY_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/utility_core.hpp> +#include <boost/move/traits.hpp> + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + namespace boost { + + ////////////////////////////////////////////////////////////////////////////// + // + // move_if_noexcept() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation<T>::value && !has_move_emulation_enabled<T>::value + , typename ::boost::move_detail::add_const<T>::type & + >::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { + return x; + } + + template <class T> + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value + && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, rv<T>&>::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { + return *static_cast<rv<T>* >(::boost::move_detail::addressof(x)); + } + + template <class T> + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value + && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value + , rv<T>& + >::type + move_if_noexcept(rv<T>& x) BOOST_NOEXCEPT + { + return x; + } + + template <class T> + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value + && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value + , typename ::boost::move_detail::add_const<T>::type & + >::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { + return x; + } + + template <class T> + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value + && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value + , typename ::boost::move_detail::add_const<T>::type & + >::type + move_if_noexcept(rv<T>& x) BOOST_NOEXCEPT + { + return x; + } + + } //namespace boost + +#else //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + #include <utility> + + namespace boost{ + + using ::std::move_if_noexcept; + + } //namespace boost + + #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE + + namespace boost { + + ////////////////////////////////////////////////////////////////////////////// + // + // move_if_noexcept() + // + ////////////////////////////////////////////////////////////////////////////// + #if defined(BOOST_MOVE_DOXYGEN_INVOKED) + //! This function provides a way to convert a reference into a rvalue reference + //! in compilers with rvalue references. For other compilers converts T & into + //! <i>::boost::rv<T> &</i> so that move emulation is activated. Reference + //! would be converted to rvalue reference only if input type is nothrow move + //! constructible or if it has no copy constructor. In all other cases const + //! reference would be returned + template <class T> + rvalue_reference_or_const_lvalue_reference move_if_noexcept(input_reference) noexcept; + + #else //BOOST_MOVE_DOXYGEN_INVOKED + + template <class T> + typename ::boost::move_detail::enable_if_c + < ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, T&&>::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { return ::boost::move(x); } + + template <class T> + typename ::boost::move_detail::enable_if_c + < !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable<T>::value, const T&>::type + move_if_noexcept(T& x) BOOST_NOEXCEPT + { return x; } + + #endif //BOOST_MOVE_DOXYGEN_INVOKED + + } //namespace boost { + + #endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + +#endif //BOOST_NO_CXX11_RVALUE_REFERENCES + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_MOVE_UTILITY_HPP diff --git a/contrib/src/boost/move/utility_core.hpp b/contrib/src/boost/move/utility_core.hpp new file mode 100644 index 0000000..7fd1ea1 --- /dev/null +++ b/contrib/src/boost/move/utility_core.hpp @@ -0,0 +1,317 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file +//! This header defines core utilities to ease the development +//! of move-aware functions. This header minimizes dependencies +//! from other libraries. + +#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/core.hpp> +#include <boost/move/detail/meta_utils.hpp> +#include <boost/static_assert.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; + }; + + ////////////////////////////////////////////////////////////////////////////// + // + // move() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline 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> + inline 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> + inline 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; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // forward() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline 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> + inline 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; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // move_if_not_lvalue_reference() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline 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> + inline 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> + inline 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); + } + + } //namespace boost + +#else //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + #include <utility> + + namespace boost{ + + using ::std::move; + using ::std::forward; + + } //namespace boost + + #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE + + namespace boost { + + //! This trait's internal boolean `value` is false in compilers with rvalue references + //! and true in compilers without rvalue references. + //! + //! A user can specialize this trait for a type T to false to SFINAE out `move` and `forward` + //! so that the user can define a different move emulation for that type in namespace boost + //! (e.g. another Boost library for its types) and avoid any overload ambiguity. + template<class T> + struct enable_move_utility_emulation + { + static const bool value = false; + }; + + ////////////////////////////////////////////////////////////////////////////// + // + // move + // + ////////////////////////////////////////////////////////////////////////////// + + #if defined(BOOST_MOVE_DOXYGEN_INVOKED) + //! This function provides a way to convert a reference into a rvalue reference + //! in compilers with rvalue references. For other compilers if `T` is Boost.Move + //! enabled type then it converts `T&` into <tt>::boost::rv<T> &</tt> so that + //! move emulation is activated, else it returns `T &`. + template <class T> + rvalue_reference move(input_reference) noexcept; + + #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + + //Old move approach, lvalues could bind to rvalue references + template <class T> + inline typename ::boost::move_detail::remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT + { return t; } + + #else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + + template <class T> + inline 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 //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + + ////////////////////////////////////////////////////////////////////////////// + // + // forward + // + ////////////////////////////////////////////////////////////////////////////// + + + #if defined(BOOST_MOVE_DOXYGEN_INVOKED) + //! This function provides limited form of forwarding that is usually enough for + //! in-place construction and avoids the exponential overloading for + //! achieve the limited forwarding in C++03. + //! + //! For compilers with rvalue references this function provides perfect forwarding. + //! + //! Otherwise: + //! * If input_reference binds to const ::boost::rv<T> & then it output_reference is + //! ::boost::rv<T> & + //! + //! * Else, output_reference is equal to input_reference. + template <class T> output_reference forward(input_reference) noexcept; + #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + + //Old move approach, lvalues could bind to rvalue references + + template <class T> + inline T&& forward(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT + { return t; } + + #else //Old move + + template <class T> + inline T&& forward(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT + { return static_cast<T&&>(t); } + + template <class T> + inline T&& forward(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT + { + //"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue."; + BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value); + return static_cast<T&&>(t); + } + + #endif //BOOST_MOVE_DOXYGEN_INVOKED + + ////////////////////////////////////////////////////////////////////////////// + // + // move_if_not_lvalue_reference + // + ////////////////////////////////////////////////////////////////////////////// + + + #if defined(BOOST_MOVE_DOXYGEN_INVOKED) + //! <b>Effects</b>: Calls `boost::move` if `input_reference` is not a lvalue reference. + //! Otherwise returns the reference + template <class T> output_reference move_if_not_lvalue_reference(input_reference) noexcept; + #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + + //Old move approach, lvalues could bind to rvalue references + + template <class T> + inline T&& move_if_not_lvalue_reference(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT + { return t; } + + #else //Old move + + template <class T> + inline 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> + inline T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT + { + //"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue."; + BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value); + return static_cast<T&&>(t); + } + + #endif //BOOST_MOVE_DOXYGEN_INVOKED + + } //namespace boost { + + #endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + +#endif //BOOST_NO_CXX11_RVALUE_REFERENCES + +#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + +namespace boost{ +namespace move_detail{ + +template <typename T> +typename boost::move_detail::add_rvalue_reference<T>::type declval(); + +} //namespace move_detail{ +} //namespace boost{ + +#endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_MOVE_UTILITY_CORE_HPP |