diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/move | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/move')
-rw-r--r-- | 3rdParty/Boost/src/boost/move/algorithm.hpp | 274 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/core.hpp | 440 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/detail/config_begin.hpp | 23 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/detail/config_end.hpp | 20 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/detail/meta_utils.hpp | 171 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/detail/move_helpers.hpp | 177 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/iterator.hpp | 298 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/move.hpp | 1266 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/traits.hpp | 150 | ||||
-rw-r--r-- | 3rdParty/Boost/src/boost/move/utility.hpp | 194 |
10 files changed, 1757 insertions, 1256 deletions
diff --git a/3rdParty/Boost/src/boost/move/algorithm.hpp b/3rdParty/Boost/src/boost/move/algorithm.hpp new file mode 100644 index 0000000..43a81c3 --- /dev/null +++ b/3rdParty/Boost/src/boost/move/algorithm.hpp @@ -0,0 +1,274 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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 + +#include <boost/move/detail/config_begin.hpp> + +#include <boost/move/utility.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_MOVE_HPP diff --git a/3rdParty/Boost/src/boost/move/core.hpp b/3rdParty/Boost/src/boost/move/core.hpp new file mode 100644 index 0000000..0efa2af --- /dev/null +++ b/3rdParty/Boost/src/boost/move/core.hpp @@ -0,0 +1,440 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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 core.hpp +//! This header implements macros to define movable classes and +//! move-aware functions + +#ifndef BOOST_MOVE_CORE_HPP +#define BOOST_MOVE_CORE_HPP + +#include <boost/move/detail/config_begin.hpp> + +//boost_move_no_copy_constructor_or_assign typedef +//used to detect noncopyable types for other Boost libraries. +#ifdef BOOST_NO_CXX11_DELETED_FUNCTIONS + #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 + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + #include <boost/move/detail/meta_utils.hpp> + + //Move emulation rv breaks standard aliasing rules so add workarounds for some compilers + #if defined(__GNUC__) && (__GNUC__ >= 4) + #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_or_union<T>::value + , T + , ::boost::move_detail::empty + >::type + { + rv(); + ~rv(); + rv(rv const&); + void operator=(rv const&); + } BOOST_MOVE_ATTRIBUTE_MAY_ALIAS; + + + ////////////////////////////////////////////////////////////////////////////// + // + // move_detail::is_rv + // + ////////////////////////////////////////////////////////////////////////////// + + namespace move_detail { + + template <class T> + struct is_rv + : ::boost::move_detail::integral_constant<bool, false> + {}; + + template <class T> + struct is_rv< rv<T> > + : ::boost::move_detail::integral_constant<bool, true> + {}; + + template <class T> + struct is_rv< const rv<T> > + : ::boost::move_detail::integral_constant<bool, true> + {}; + + } //namespace move_detail { + + ////////////////////////////////////////////////////////////////////////////// + // + // has_move_emulation_enabled + // + ////////////////////////////////////////////////////////////////////////////// + template<class T> + struct has_move_emulation_enabled + : ::boost::move_detail::is_convertible< T, ::boost::rv<T>& > + {}; + + template<class T> + struct has_move_emulation_enabled<T&> + : ::boost::move_detail::integral_constant<bool, false> + {}; + + template<class T> + struct has_move_emulation_enabled< ::boost::rv<T> > + : ::boost::move_detail::integral_constant<bool, false> + {}; + + } //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_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 *static_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) + // + + ////////////////////////////////////////////////////////////////////////////// + // + // 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 *static_cast< ::boost::rv<TYPE>* >(this); }\ + operator const ::boost::rv<TYPE>&() const \ + { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ + private:\ + // + + ////////////////////////////////////////////////////////////////////////////// + // + // BOOST_COPYABLE_AND_MOVABLE + // + ////////////////////////////////////////////////////////////////////////////// + + #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ + public:\ + TYPE& operator=(TYPE &t)\ + { this->operator=(static_cast<const ::boost::rv<TYPE> &>(const_cast<const TYPE &>(t))); return *this;}\ + public:\ + operator ::boost::rv<TYPE>&() \ + { return *static_cast< ::boost::rv<TYPE>* >(this); }\ + operator const ::boost::rv<TYPE>&() const \ + { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ + private:\ + // + + #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\ + public:\ + operator ::boost::rv<TYPE>&() \ + { return *static_cast< ::boost::rv<TYPE>* >(this); }\ + operator const ::boost::rv<TYPE>&() const \ + { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ + private:\ + // + +#else //BOOST_NO_CXX11_RVALUE_REFERENCES + + //Compiler workaround detection + #if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + #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 + //Use standard library for MSVC to avoid namespace issues as + //some move calls in the STL are not fully qualified. + //#define BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE + #elif defined(_MSC_VER) && (_MSC_VER == 1700) + #define BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG + #endif + #endif + + //! 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; + }; + + } //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 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 Standard allows implicit move returns when the object to be returned + //!is designated by an 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 a 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 used 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) + +#endif //BOOST_NO_CXX11_RVALUE_REFERENCES + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_CORE_HPP diff --git a/3rdParty/Boost/src/boost/move/detail/config_begin.hpp b/3rdParty/Boost/src/boost/move/detail/config_begin.hpp new file mode 100644 index 0000000..837ee12 --- /dev/null +++ b/3rdParty/Boost/src/boost/move/detail/config_begin.hpp @@ -0,0 +1,23 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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. +// +////////////////////////////////////////////////////////////////////////////// +#include <boost/config.hpp> + +#ifdef BOOST_MSVC + #ifndef _CRT_SECURE_NO_DEPRECATE + #define BOOST_MOVE_CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE + #endif + #ifndef _SCL_SECURE_NO_WARNINGS + #define BOOST_MOVE_SCL_SECURE_NO_WARNINGS + #define _SCL_SECURE_NO_WARNINGS + #endif + #pragma warning (push) + #pragma warning (disable : 4996) // "function": was declared deprecated +#endif diff --git a/3rdParty/Boost/src/boost/move/detail/config_end.hpp b/3rdParty/Boost/src/boost/move/detail/config_end.hpp new file mode 100644 index 0000000..5f83231 --- /dev/null +++ b/3rdParty/Boost/src/boost/move/detail/config_end.hpp @@ -0,0 +1,20 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined BOOST_MSVC + #pragma warning (pop) + #ifdef BOOST_MOVE_CRT_SECURE_NO_DEPRECATE + #undef BOOST_MOVE_CRT_SECURE_NO_DEPRECATE + #undef _CRT_SECURE_NO_DEPRECATE + #endif + #ifdef BOOST_MOVE_SCL_SECURE_NO_WARNINGS + #undef BOOST_MOVE_SCL_SECURE_NO_WARNINGS + #undef _SCL_SECURE_NO_WARNINGS + #endif +#endif diff --git a/3rdParty/Boost/src/boost/move/detail/meta_utils.hpp b/3rdParty/Boost/src/boost/move/detail/meta_utils.hpp new file mode 100644 index 0000000..0da3c68 --- /dev/null +++ b/3rdParty/Boost/src/boost/move/detail/meta_utils.hpp @@ -0,0 +1,171 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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_DETAIL_META_UTILS_HPP +#define BOOST_MOVE_DETAIL_META_UTILS_HPP + +#include <boost/move/detail/config_begin.hpp> + +//Small meta-typetraits to support move + +namespace boost { +namespace move_detail { + +//if_ +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; +}; + +template<typename T1, typename T2, typename T3> +struct if_ +{ + typedef typename if_c<0 != T1::value, T2, T3>::type type; +}; + +//enable_if_ +template <bool B, class T = void> +struct enable_if_c +{ + typedef T type; +}; + +template <class T> +struct enable_if_c<false, T> {}; + +template <class Cond, class T = void> +struct enable_if : public enable_if_c<Cond::value, T> {}; + +template <class Cond, class T = void> +struct disable_if : public 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; +}; + +//identity +template <class T> +struct identity +{ + typedef T type; +}; + +#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 char true_t; + class false_t { char dummy[2]; }; + static false_t dispatch(...); + static true_t dispatch(U); + static T &trigger(); + public: + static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t); +}; + +#endif + +//and_ not_ +template <typename Condition1, typename Condition2, typename Condition3 = integral_constant<bool, true> > +struct and_ + : public integral_constant<bool, Condition1::value && Condition2::value && Condition3::value> +{}; + +template <typename Boolean> +struct not_ + : public integral_constant<bool, !Boolean::value> +{}; + +//is_lvalue_reference +template<class T> +struct is_lvalue_reference + : public integral_constant<bool, false> +{}; + +template<class T> +struct is_lvalue_reference<T&> + : public integral_constant<bool, true> +{}; + +template<class T> +struct is_class_or_union +{ + struct twochar { char _[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); +}; + +struct empty{}; + +//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 ); +} + +} //namespace move_detail { +} //namespace boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP diff --git a/3rdParty/Boost/src/boost/move/detail/move_helpers.hpp b/3rdParty/Boost/src/boost/move/detail/move_helpers.hpp new file mode 100644 index 0000000..ed6f3d5 --- /dev/null +++ b/3rdParty/Boost/src/boost/move/detail/move_helpers.hpp @@ -0,0 +1,177 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2010-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_MOVE_MOVE_HELPERS_HPP +#define BOOST_MOVE_MOVE_HELPERS_HPP + +#include <boost/move/utility.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/move/utility.hpp> +#include <boost/move/traits.hpp> + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined(_MSC_VER) && (_MSC_VER == 1600)) +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/utility/enable_if.hpp> +#endif +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#include <boost/mpl/if.hpp> +#endif + + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +struct not_a_type; +struct not_a_type2; +#define BOOST_MOVE_CATCH_CONST(U) \ + typename ::boost::mpl::if_< ::boost::is_class<U>, BOOST_CATCH_CONST_RLVALUE(U), const U &>::type +#define BOOST_MOVE_CATCH_RVALUE(U)\ + typename ::boost::mpl::if_< ::boost::is_class<U>, BOOST_RV_REF(U), not_a_type>::type +#define BOOST_MOVE_CATCH_FWD(U) BOOST_FWD_REF(U) +#else +#define BOOST_MOVE_CATCH_CONST(U) const U & +#define BOOST_MOVE_CATCH_RVALUE(U) U && +#define BOOST_MOVE_CATCH_FWD(U) U && +#endif + +#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ + RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ + { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + { return FWD_FUNCTION(::boost::move(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(TYPE &x)\ + { return FWD_FUNCTION(const_cast<const TYPE &>(x)); }\ +\ + template<class BOOST_MOVE_TEMPL_PARAM>\ + typename ::boost::enable_if_c\ + < ::boost::is_class<TYPE>::value &&\ + ::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\ + !::boost::has_move_emulation_enabled<BOOST_MOVE_TEMPL_PARAM>::value\ + , RETURN_VALUE >::type\ + PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\ + { return FWD_FUNCTION(u); }\ +\ + template<class BOOST_MOVE_TEMPL_PARAM>\ + typename ::boost::enable_if_c\ + < (!::boost::is_class<BOOST_MOVE_TEMPL_PARAM>::value || \ + !::boost::move_detail::is_rv<BOOST_MOVE_TEMPL_PARAM>::value) && \ + !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value \ + , RETURN_VALUE >::type\ + PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\ + {\ + TYPE t(u);\ + return FWD_FUNCTION(::boost::move(t));\ + }\ +// +// ::boost::is_convertible<BOOST_MOVE_TEMPL_PARAM, TYPE>::value && +#elif (defined(_MSC_VER) && (_MSC_VER == 1600)) + +#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ + RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ + { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + { return FWD_FUNCTION(::boost::move(x)); }\ +\ + template<class BOOST_MOVE_TEMPL_PARAM>\ + typename ::boost::enable_if_c\ + < !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value\ + , RETURN_VALUE >::type\ + PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\ + {\ + TYPE t(u);\ + return FWD_FUNCTION(::boost::move(t));\ + }\ +// + +#else + +#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\ + RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\ + { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + { return FWD_FUNCTION(::boost::move(x)); }\ +// + +#endif + + +#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES + +#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ + RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ + { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + { return FWD_FUNCTION(arg1, ::boost::move(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(ARG1 arg1, TYPE &x)\ + { return FWD_FUNCTION(arg1, const_cast<const TYPE &>(x)); }\ +\ + template<class BOOST_MOVE_TEMPL_PARAM>\ + typename ::boost::enable_if_c<\ + ::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\ + !::boost::has_move_emulation_enabled<BOOST_MOVE_TEMPL_PARAM>::value\ + , RETURN_VALUE >::type\ + PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\ + { return FWD_FUNCTION(arg1, u); }\ +\ + template<class BOOST_MOVE_TEMPL_PARAM>\ + typename ::boost::enable_if_c<\ + !::boost::move_detail::is_rv<BOOST_MOVE_TEMPL_PARAM>::value && \ + !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value && \ + !::boost::is_convertible<BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO>::value \ + , RETURN_VALUE >::type\ + PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\ + {\ + TYPE t(u);\ + return FWD_FUNCTION(arg1, ::boost::move(t));\ + }\ +// + +#elif (defined(_MSC_VER) && (_MSC_VER == 1600)) + +#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ + RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ + { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + { return FWD_FUNCTION(arg1, ::boost::move(x)); }\ +\ + template<class BOOST_MOVE_TEMPL_PARAM>\ + typename ::boost::enable_if_c\ + < !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value && \ + !::boost::is_convertible<BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO>::value \ + , RETURN_VALUE >::type\ + PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\ + {\ + TYPE t(u);\ + return FWD_FUNCTION(arg1, ::boost::move(t));\ + }\ +// + +#else + +#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\ + RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\ + { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\ +\ + RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \ + { return FWD_FUNCTION(arg1, ::boost::move(x)); }\ +// + +#endif + +#endif //#ifndef BOOST_MOVE_MOVE_HELPERS_HPP diff --git a/3rdParty/Boost/src/boost/move/iterator.hpp b/3rdParty/Boost/src/boost/move/iterator.hpp new file mode 100644 index 0000000..b4bc1af --- /dev/null +++ b/3rdParty/Boost/src/boost/move/iterator.hpp @@ -0,0 +1,298 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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 + +#include <boost/move/detail/config_begin.hpp> +#include <boost/move/utility.hpp> +#include <iterator> //std::iterator + +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 std::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 std::iterator_traits<iterator_type>::difference_type difference_type; + typedef typename std::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 + : public ::boost::move_detail::integral_constant<bool, false> +{ +}; + +template <class I> +struct is_move_iterator< ::boost::move_iterator<I> > + : public ::boost::move_detail::integral_constant<bool, 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 + : public std::iterator<std::output_iterator_tag, void, void, void, void> +{ + C* container_m; + + public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + + 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 + : public std::iterator<std::output_iterator_tag, void, void, void, void> +{ + C* container_m; + +public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + + 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 + : public std::iterator<std::output_iterator_tag, void, void, void, void> +{ + C* container_m; + typename C::iterator pos_; + + public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + + 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/3rdParty/Boost/src/boost/move/move.hpp b/3rdParty/Boost/src/boost/move/move.hpp index 6029d6d..66e99a7 100644 --- a/3rdParty/Boost/src/boost/move/move.hpp +++ b/3rdParty/Boost/src/boost/move/move.hpp @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright David Abrahams, Vicente Botet 2009. -// (C) Copyright Ion Gaztanaga 2009-2010. +// (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) @@ -10,1264 +10,18 @@ // ////////////////////////////////////////////////////////////////////////////// -//! \file +//! \file move.hpp +//! A general library header that includes +//! the rest of top-level headers. #ifndef BOOST_MOVE_MOVE_HPP #define BOOST_MOVE_MOVE_HPP -#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) - -/// @cond - -#include <boost/config.hpp> - -#ifdef BOOST_MSVC - #ifndef _CRT_SECURE_NO_DEPRECATE - #define BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE - #define _CRT_SECURE_NO_DEPRECATE - #endif - #ifndef _SCL_SECURE_NO_WARNINGS - #define BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS - #define _SCL_SECURE_NO_WARNINGS - #endif - #pragma warning (push) - #pragma warning(disable:4996) -#endif - -#include <algorithm> //copy, copy_backward -#include <memory> //uninitialized_copy -#include <iterator> //std::iterator - -#define BOOST_MOVE_AVOID_BOOST_DEPENDENCIES - -//If boost dependencies are avoided include all machinery -#if !defined(BOOST_MOVE_AVOID_BOOST_DEPENDENCIES) - #include <boost/utility/enable_if.hpp> - #include <boost/utility/addressof.hpp> - #include <boost/mpl/if.hpp> - #include <boost/mpl/bool.hpp> - #include <boost/mpl/and.hpp> - #include <boost/mpl/not.hpp> - #include <boost/mpl/identity.hpp> - #include <boost/type_traits/is_class.hpp> - #include <boost/type_traits/is_convertible.hpp> - #include <boost/type_traits/has_trivial_destructor.hpp> - #include <boost/type_traits/integral_constant.hpp> - - #define BOOST_MOVE_MPL_NS ::boost::mpl - #define BOOST_MOVE_BOOST_NS ::boost -#else - #define BOOST_MOVE_MPL_NS ::boost::move_detail - #define BOOST_MOVE_BOOST_NS ::boost::move_detail -#endif //#ifdef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES - -//Small meta-typetraits to support move -#ifdef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES - - namespace boost { - namespace move_detail { - - //if_ - 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; - }; - - template<typename T1, typename T2, typename T3> - struct if_ - { - typedef typename if_c<0 != T1::value, T2, T3>::type type; - }; - - //enable_if_ - template <bool B, class T = void> - struct enable_if_c - { - typedef T type; - }; - - template <class T> - struct enable_if_c<false, T> {}; - - template <class Cond, class T = void> - struct enable_if : public enable_if_c<Cond::value, T> {}; - - template <class Cond, class T = void> - struct disable_if : public 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; - }; - - //identity - template <class T> - struct identity - { - typedef T type; - }; - - //is_convertible - template <class T, class U> - class is_convertible - { - typedef char true_t; - class false_t { char dummy[2]; }; - static true_t dispatch(U); - static false_t dispatch(...); - static T &trigger(); - public: - enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; - }; - - //and_ not_ - template <typename Condition1, typename Condition2, typename Condition3 = integral_constant<bool, true> > - struct and_ - : public integral_constant<bool, Condition1::value && Condition2::value && Condition3::value> - {}; - - template <typename Boolean> - struct not_ - : public integral_constant<bool, !Boolean::value> - {}; - - //is_lvalue_reference - template<class T> - struct is_lvalue_reference - : public integral_constant<bool, false> - {}; - - template<class T> - struct is_lvalue_reference<T&> - : public integral_constant<bool, true> - {}; - - //has_trivial_destructor - template<class T> - struct has_trivial_destructor - : public integral_constant<bool, false> - {}; - - //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 ); - } - - } //namespace move_detail { - } //namespace boost { - -#endif //BOOST_MOVE_AVOID_BOOST_DEPENDENCIES - -//Compiler workaround detection -#if !defined(BOOST_NO_RVALUE_REFERENCES) - - #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 - //Use standard library for MSVC to avoid namespace issues as - //some move calls in the STL are not fully qualified. - //#define BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE - #endif - -#endif - -/// @endcond - -#endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) - -#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) - - //Move emulation rv breaks standard aliasing rules so add workarounds for some compilers - #if defined(__GNUC__) && (__GNUC__ >= 4) - #define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__)) - #else - #define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS - #endif - - namespace boost { - - namespace move_detail { - template<class T> - struct is_class_or_union - { - struct twochar { char _[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); - }; - struct empty{}; - } - - ////////////////////////////////////////////////////////////////////////////// - // - // struct rv - // - ////////////////////////////////////////////////////////////////////////////// - template <class T> - class rv - : public BOOST_MOVE_MPL_NS::if_c - < ::boost::move_detail::is_class_or_union<T>::value - , T - , ::boost::move_detail::empty - >::type - { - rv(); - ~rv(); - rv(rv const&); - void operator=(rv const&); - } BOOST_MOVE_ATTRIBUTE_MAY_ALIAS; - - - - ////////////////////////////////////////////////////////////////////////////// - // - // move_detail::is_rv - // - ////////////////////////////////////////////////////////////////////////////// - - namespace move_detail { - - template <class T> - struct is_rv - : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> - {}; - - template <class T> - struct is_rv< rv<T> > - : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> - {}; - - template <class T> - struct is_rv< const rv<T> > - : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> - {}; - - } //namespace move_detail { - - ////////////////////////////////////////////////////////////////////////////// - // - // has_move_emulation_enabled - // - ////////////////////////////////////////////////////////////////////////////// - template<class T> - struct has_move_emulation_enabled - : BOOST_MOVE_BOOST_NS::is_convertible< T, ::boost::rv<T>& > - {}; - - template<class T> - struct has_move_emulation_enabled<T&> - : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> - {}; - - template<class T> - struct has_move_emulation_enabled< ::boost::rv<T> > - : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> - {}; - - template <class T> - struct has_move_emulation_enabled_aux - : has_move_emulation_enabled<T> {}; - - template <class T> - struct has_nothrow_move - : public BOOST_MOVE_BOOST_NS::integral_constant<bool, false> - {}; - - ////////////////////////////////////////////////////////////////////////////// - // - // move() - // - ////////////////////////////////////////////////////////////////////////////// - - template <class T> - inline typename BOOST_MOVE_BOOST_NS::disable_if<has_move_emulation_enabled_aux<T>, T&>::type move(T& x) - { - return x; - } - - template <class T> - inline typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<T>, rv<T>&>::type move(T& x) - { - return *static_cast<rv<T>* >(BOOST_MOVE_BOOST_NS::addressof(x)); - } - - template <class T> - inline typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<T>, rv<T>&>::type move(rv<T>& x) - { - return x; - } - - #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_FWD_REF(TYPE)\ - const TYPE & \ - // - - #define BOOST_CATCH_CONST_RLVALUE(TYPE)\ - const ::boost::rv< 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_MOVE_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ - const ::boost::rv< TYPE<ARG1, ARG2> >& \ - // - - #define BOOST_MOVE_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ - const ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \ - // - - ////////////////////////////////////////////////////////////////////////////// - // - // forward() - // - ////////////////////////////////////////////////////////////////////////////// - - template <class T> - inline typename BOOST_MOVE_BOOST_NS::enable_if< ::boost::move_detail::is_rv<T>, T &>::type - forward(const typename BOOST_MOVE_MPL_NS::identity<T>::type &x) - { - return const_cast<T&>(x); - } - - template <class T> - inline typename BOOST_MOVE_BOOST_NS::disable_if< ::boost::move_detail::is_rv<T>, const T &>::type - forward(const typename BOOST_MOVE_MPL_NS::identity<T>::type &x) - { - return x; - } - - ////////////////////////////////////////////////////////////////////////////// - // - // BOOST_MOVABLE_BUT_NOT_COPYABLE - // - ////////////////////////////////////////////////////////////////////////////// - #define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ - private:\ - TYPE(TYPE &);\ - TYPE& operator=(TYPE &);\ - public:\ - operator ::boost::rv<TYPE>&() \ - { return *static_cast< ::boost::rv<TYPE>* >(this); }\ - operator const ::boost::rv<TYPE>&() const \ - { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ - private:\ - // - - ////////////////////////////////////////////////////////////////////////////// - // - // BOOST_COPYABLE_AND_MOVABLE - // - ////////////////////////////////////////////////////////////////////////////// - - #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ - public:\ - TYPE& operator=(TYPE &t)\ - { this->operator=(static_cast<const ::boost::rv<TYPE> &>(const_cast<const TYPE &>(t))); return *this;}\ - public:\ - operator ::boost::rv<TYPE>&() \ - { return *static_cast< ::boost::rv<TYPE>* >(this); }\ - operator const ::boost::rv<TYPE>&() const \ - { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ - private:\ - // - - #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\ - public:\ - operator ::boost::rv<TYPE>&() \ - { return *static_cast< ::boost::rv<TYPE>* >(this); }\ - operator const ::boost::rv<TYPE>&() const \ - { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ - private:\ - // - - } //namespace boost - -#else //BOOST_NO_RVALUE_REFERENCES - - namespace boost{ - - //! By default this traits returns false. Classes with non-throwing move constructor - //! and assignment should specialize this trait to obtain some performance improvements. - template <class T> - struct has_nothrow_move - : public BOOST_MOVE_MPL_NS::integral_constant<bool, false> - {}; - - } // namespace boost{ - - #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) - #include <utility> - - namespace boost{ - - using ::std::move; - using ::std::forward; - using ::std::move_backward; - - } //namespace boost - - #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE - - #include <boost/type_traits/remove_reference.hpp> - - namespace boost { - - ////////////////////////////////////////////////////////////////////////////// - // - // 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 converts T & into - //! <i>::boost::rv<T> &</i> so that move emulation is activated. - template <class T> - rvalue_reference move (input_reference); - - #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) - - //Old move approach, lvalues could bind to rvalue references - template <class T> - inline typename remove_reference<T>::type && move(T&& t) - { return t; } - - #else //Old move - - template <class T> - inline typename remove_reference<T>::type && move(T&& t) - { return static_cast<typename remove_reference<T>::type &&>(t); } - - #endif //Old move - - ////////////////////////////////////////////////////////////////////////////// - // - // 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 necessary for - //! perfect 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::rev<T> & - //! - //! * Else, input_reference is equal to output_reference is equal to input_reference. - template <class T> output_reference forward(input_reference); - #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_MPL_NS::identity<T>::type&& t) - { return t; } - - #else //Old move - - //Implementation #5 from N2951, thanks to Howard Hinnant - - template <class T, class U> - inline T&& forward(U&& t - , typename BOOST_MOVE_BOOST_NS::enable_if_c< - move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0/* - , typename BOOST_MOVE_BOOST_NS::enable_if_c< - move_detail::is_convertible - <typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0*/) - { return static_cast<T&&>(t); } - - #endif //BOOST_MOVE_DOXYGEN_INVOKED - - } //namespace boost { - - #endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) - - //! 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)\ - public:\ - typedef int boost_move_emulation_t;\ - private:\ - TYPE(const TYPE &);\ - TYPE& operator=(const TYPE &);\ - // - - //! This macro marks a type as copyable and movable. - //! The user will need to write a move constructor/assignment and a copy assignment - //! as explained in the documentation to fully write a copyable and movable class. - #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ - // - - #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\ - // - - //!This macro is used to achieve portable syntax in move - //!constructors and assignments for classes marked as - //!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE - #define BOOST_RV_REF(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 problem with comma-separatd template arguments, - //!the template argument must be preceded with BOOST_RV_REF_START - //!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 problem with comma-separatd template arguments, - //!the template argument must be preceded with BOOST_RV_REF_START - //!and ended with BOOST_RV_REF_END - #define 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) - /// @cond - - #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_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ - const TYPE<ARG1, ARG2> & \ - // - - #define BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ - TYPE<ARG1, ARG2, ARG3>& \ - // - - #define BOOST_CATCH_CONST_RLVALUE(TYPE)\ - const TYPE & \ - // - - /// @endcond - - #endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) - -#endif //BOOST_NO_RVALUE_REFERENCES - -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 std::iterator_traits<iterator_type>::value_type value_type; - #if !defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED) - typedef value_type && reference; - #else - typedef typename BOOST_MOVE_MPL_NS::if_ - < ::boost::has_move_emulation_enabled<value_type> - , ::boost::rv<value_type>& - , value_type & >::type reference; - #endif - typedef It pointer; - typedef typename std::iterator_traits<iterator_type>::difference_type difference_type; - typedef typename std::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_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_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 - : public BOOST_MOVE_BOOST_NS::integral_constant<bool, false> -{ -}; - -template <class I> -struct is_move_iterator< ::boost::move_iterator<I> > - : public BOOST_MOVE_BOOST_NS::integral_constant<bool, 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 - : public std::iterator<std::output_iterator_tag, void, void, void, void> -{ - C* container_m; - - public: - typedef C container_type; - typedef typename C::value_type value_type; - typedef typename C::reference reference; - - 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 - : public std::iterator<std::output_iterator_tag, void, void, void, void> -{ - C* container_m; - -public: - typedef C container_type; - typedef typename C::value_type value_type; - typedef typename C::reference reference; - - 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 - : public std::iterator<std::output_iterator_tag, void, void, void, void> -{ - C* container_m; - typename C::iterator pos_; - - public: - typedef C container_type; - typedef typename C::value_type value_type; - typedef typename C::reference reference; - - 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); -} - -////////////////////////////////////////////////////////////////////////////// -// -// 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; - } - -#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_BOOST_NS::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; - while (f != l) { - ::new(static_cast<void*>(&*r)) input_value_type(boost::move(*f)); - ++f; ++r; - } - 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_BOOST_NS::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_BOOST_NS::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_BOOST_NS::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_BOOST_NS::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_BOOST_NS::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_BOOST_NS::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_BOOST_NS::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_BOOST_NS::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_BOOST_NS::disable_if< move_detail::is_move_iterator<I> >::type* = 0 - /// @endcond - ) -{ - return std::copy(f, l, r); -} - -//! 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_BOOST_NS::has_trivial_destructor<T> -{}; - - - -namespace move_detail { - -// Code from Jeffrey Lee Hellrung, many thanks - -#ifndef BOOST_NO_RVALUE_REFERENCES - template< class T> struct forward_type { typedef T type; }; -#else // #ifndef BOOST_NO_RVALUE_REFERENCES - template< class T> - struct forward_type - { typedef const T &type; }; - - template< class T> - struct forward_type< boost::rv<T> > - { typedef T type; }; -#endif // #ifndef BOOST_NO_RVALUE_REFERENCES - - - -// Code from Jeffrey Lee Hellrung, many thanks - -template< class T > struct is_rvalue_reference : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> { }; -#ifndef BOOST_NO_RVALUE_REFERENCES - template< class T > struct is_rvalue_reference< T&& > : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> { }; -#else // #ifndef BOOST_NO_RVALUE_REFERENCES - template< class T > struct is_rvalue_reference< boost::rv<T>& > - : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> - {}; - - template< class T > struct is_rvalue_reference< const boost::rv<T>& > - : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> - {}; -#endif // #ifndef BOOST_NO_RVALUE_REFERENCES - -#ifndef BOOST_NO_RVALUE_REFERENCES - template< class T > struct add_rvalue_reference { typedef T&& type; }; -#else // #ifndef BOOST_NO_RVALUE_REFERENCES - namespace detail_add_rvalue_reference - { - template< class T - , bool emulation = ::boost::has_move_emulation_enabled<T>::value - , bool rv = ::boost::move_detail::is_rv<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_RVALUE_REFERENCES - -template< class T > struct remove_rvalue_reference { typedef T type; }; - -#ifndef BOOST_NO_RVALUE_REFERENCES - template< class T > struct remove_rvalue_reference< T&& > { typedef T type; }; -#else // #ifndef BOOST_NO_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_RVALUE_REFERENCES - -template <typename T> -typename boost::move_detail::add_rvalue_reference<T>::type declval(); - -} -// 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 boost { - -#if defined BOOST_MSVC - #pragma warning (pop) - #ifdef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE - #undef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE - #undef _CRT_SECURE_NO_DEPRECATE - #endif - - #ifdef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS - #undef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS - #undef _SCL_SECURE_NO_WARNINGS - #endif -#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/3rdParty/Boost/src/boost/move/traits.hpp b/3rdParty/Boost/src/boost/move/traits.hpp new file mode 100644 index 0000000..ced1cdd --- /dev/null +++ b/3rdParty/Boost/src/boost/move/traits.hpp @@ -0,0 +1,150 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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_MOVE_TRAITS_HPP +#define BOOST_MOVE_MOVE_TRAITS_HPP + +#include <boost/move/detail/config_begin.hpp> +#include <boost/type_traits/has_trivial_destructor.hpp> +#include <boost/type_traits/is_nothrow_move_constructible.hpp> +#include <boost/type_traits/is_nothrow_move_assignable.hpp> +#include <boost/move/detail/meta_utils.hpp> + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#include <boost/move/core.hpp> +#endif + +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::has_trivial_destructor<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 + : public ::boost::move_detail::integral_constant + < bool + , boost::is_nothrow_move_constructible<T>::value && + boost::is_nothrow_move_assignable<T>::value + > +{}; + +namespace move_detail { + +// Code from Jeffrey Lee Hellrung, many thanks + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template< class T> struct forward_type { typedef T type; }; +#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template< class T> + struct forward_type + { typedef const T &type; }; + + template< class T> + struct forward_type< boost::rv<T> > + { typedef T type; }; +#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template< class T > struct is_rvalue_reference : ::boost::move_detail::integral_constant<bool, false> { }; +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template< class T > struct is_rvalue_reference< T&& > : ::boost::move_detail::integral_constant<bool, true> { }; +#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template< class T > struct is_rvalue_reference< boost::rv<T>& > + : ::boost::move_detail::integral_constant<bool, true> + {}; + + template< class T > struct is_rvalue_reference< const boost::rv<T>& > + : ::boost::move_detail::integral_constant<bool, 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 = ::boost::has_move_emulation_enabled<T>::value + , bool rv = ::boost::move_detail::is_rv<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 + +template <typename T> +typename boost::move_detail::add_rvalue_reference<T>::type declval(); + +} //move_detail { + +// 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 boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_MOVE_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/move/utility.hpp b/3rdParty/Boost/src/boost/move/utility.hpp new file mode 100644 index 0000000..964500e --- /dev/null +++ b/3rdParty/Boost/src/boost/move/utility.hpp @@ -0,0 +1,194 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (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_MOVE_UTILITY_HPP +#define BOOST_MOVE_MOVE_UTILITY_HPP + +#include <boost/move/detail/config_begin.hpp> +#include <boost/move/core.hpp> +#include <boost/move/detail/meta_utils.hpp> + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + namespace boost { + + template<class T> + struct enable_move_utility_emulation + { + static const bool value = true; + }; + + ////////////////////////////////////////////////////////////////////////////// + // + // move() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation<T>::value && !has_move_emulation_enabled<T>::value, T&>::type + move(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, rv<T>&>::type + move(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, rv<T>&>::type + move(rv<T>& x) BOOST_NOEXCEPT + { + return x; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // forward() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline typename ::boost::move_detail::enable_if_c + < enable_move_utility_emulation<T>::value && ::boost::move_detail::is_rv<T>::value, 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_c + < enable_move_utility_emulation<T>::value && !::boost::move_detail::is_rv<T>::value, const T &>::type + forward(const typename ::boost::move_detail::identity<T>::type &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; + using ::std::forward; + + } //namespace boost + + #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE + + #include <boost/type_traits/remove_reference.hpp> + + 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 converts T & into + //! <i>::boost::rv<T> &</i> so that move emulation is activated. + 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 remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT + { return t; } + + #else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + + template <class T> + inline typename remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT + { return static_cast<typename 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 + + //Implementation #5 from N2951, thanks to Howard Hinnant + + template <class T, class U> + inline T&& forward(U&& t + , typename ::boost::move_detail::enable_if_c< + move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0/* + , typename ::boost::move_detail::enable_if_c< + move_detail::is_convertible + <typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0*/) BOOST_NOEXCEPT + { 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 + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_MOVE_UTILITY_HPP |