////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2012-2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// //! \file #ifndef BOOST_MOVE_ALGORITHM_HPP #define BOOST_MOVE_ALGORITHM_HPP #ifndef BOOST_CONFIG_HPP # include #endif # #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include #include #include #include #include #include //copy, copy_backward #include //uninitialized_copy namespace boost { ////////////////////////////////////////////////////////////////////////////// // // uninitialized_copy_or_move // ////////////////////////////////////////////////////////////////////////////// namespace move_detail { template // 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 >::type* = 0 ) { return ::boost::uninitialized_move(f, l, r); } /* template // F models ForwardIterator F uninitialized_move_move_iterator(I f, I l, F r, typename ::boost::move_detail::disable_if< has_move_emulation_enabled >::type* = 0) { return std::uninitialized_copy(f.base(), l.base(), r); } */ } //namespace move_detail { template // 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 >::type* = 0) { return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // // copy_or_move // ////////////////////////////////////////////////////////////////////////////// namespace move_detail { template // F models ForwardIterator inline F move_move_iterator(I f, I l, F r // ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled >::type* = 0 ) { return ::boost::move(f, l, r); } /* template // F models ForwardIterator F move_move_iterator(I f, I l, F r, typename ::boost::move_detail::disable_if< has_move_emulation_enabled >::type* = 0) { return std::copy(f.base(), l.base(), r); } */ } //namespace move_detail { template // 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 >::type* = 0) { return ::boost::move_detail::move_move_iterator(f, l, r); } /// @endcond //! Effects: //! \code //! for (; first != last; ++result, ++first) //! new (static_cast(&*result)) //! typename iterator_traits::value_type(*first); //! \endcode //! //! Returns: result //! //! Note: This function is provided because //! std::uninitialized_copy from some STL implementations //! is not compatible with move_iterator template // 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 >::type* = 0 /// @endcond ) { return std::uninitialized_copy(f, l, r); } //! Effects: //! \code //! for (; first != last; ++result, ++first) //! *result = *first; //! \endcode //! //! Returns: result //! //! Note: This function is provided because //! std::uninitialized_copy from some STL implementations //! is not compatible with move_iterator template // 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 >::type* = 0 /// @endcond ) { return std::copy(f, l, r); } } //namespace boost { #include #endif //#ifndef BOOST_MOVE_ALGORITHM_HPP