Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:52

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2012-2016.
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // See http://www.boost.org/libs/move for documentation.
0009 //
0010 //////////////////////////////////////////////////////////////////////////////
0011 
0012 //! \file
0013 
0014 #ifndef BOOST_MOVE_ALGO_MOVE_HPP
0015 #define BOOST_MOVE_ALGO_MOVE_HPP
0016 
0017 #ifndef BOOST_CONFIG_HPP
0018 #  include <boost/config.hpp>
0019 #endif
0020 #
0021 #if defined(BOOST_HAS_PRAGMA_ONCE)
0022 #  pragma once
0023 #endif
0024 
0025 #include <boost/move/detail/config_begin.hpp>
0026 
0027 #include <boost/move/utility_core.hpp>
0028 #include <boost/move/detail/iterator_traits.hpp>
0029 #include <boost/move/detail/iterator_to_raw_pointer.hpp>
0030 #include <boost/move/detail/addressof.hpp>
0031 #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0032 #include <algorithm>
0033 #endif
0034 
0035 namespace boost {
0036 
0037 //////////////////////////////////////////////////////////////////////////////
0038 //
0039 //                               move
0040 //
0041 //////////////////////////////////////////////////////////////////////////////
0042 
0043 #if !defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0044 
0045    //! <b>Effects</b>: Moves elements in the range [first,last) into the range [result,result + (last -
0046    //!   first)) starting from first and proceeding to last. For each non-negative integer n < (last-first),
0047    //!   performs *(result + n) = ::boost::move (*(first + n)).
0048    //!
0049    //! <b>Effects</b>: result + (last - first).
0050    //!
0051    //! <b>Requires</b>: result shall not be in the range [first,last).
0052    //!
0053    //! <b>Complexity</b>: Exactly last - first move assignments.
0054    template <typename I, // I models InputIterator
0055             typename O> // O models OutputIterator
0056    O move(I f, I l, O result)
0057    {
0058       while (f != l) {
0059          *result = ::boost::move(*f);
0060          ++f; ++result;
0061       }
0062       return result;
0063    }
0064 
0065    //////////////////////////////////////////////////////////////////////////////
0066    //
0067    //                               move_backward
0068    //
0069    //////////////////////////////////////////////////////////////////////////////
0070 
0071    //! <b>Effects</b>: Moves elements in the range [first,last) into the range
0072    //!   [result - (last-first),result) starting from last - 1 and proceeding to
0073    //!   first. For each positive integer n <= (last - first),
0074    //!   performs *(result - n) = ::boost::move(*(last - n)).
0075    //!
0076    //! <b>Requires</b>: result shall not be in the range [first,last).
0077    //!
0078    //! <b>Returns</b>: result - (last - first).
0079    //!
0080    //! <b>Complexity</b>: Exactly last - first assignments.
0081    template <typename I, // I models BidirectionalIterator
0082    typename O> // O models BidirectionalIterator
0083    O move_backward(I f, I l, O result)
0084    {
0085       while (f != l) {
0086          --l; --result;
0087          *result = ::boost::move(*l);
0088       }
0089       return result;
0090    }
0091 
0092 #else
0093 
0094    using ::std::move_backward;
0095 
0096 #endif   //!defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0097 
0098 //////////////////////////////////////////////////////////////////////////////
0099 //
0100 //                               uninitialized_move
0101 //
0102 //////////////////////////////////////////////////////////////////////////////
0103 
0104 //! <b>Effects</b>:
0105 //!   \code
0106 //!   for (; first != last; ++result, ++first)
0107 //!      new (static_cast<void*>(&*result))
0108 //!         typename iterator_traits<ForwardIterator>::value_type(boost::move(*first));
0109 //!   \endcode
0110 //!
0111 //! <b>Returns</b>: result
0112 template
0113    <typename I, // I models InputIterator
0114     typename F> // F models ForwardIterator
0115 F uninitialized_move(I f, I l, F r
0116    /// @cond
0117 //   ,typename ::boost::move_detail::enable_if<has_move_emulation_enabled<typename boost::movelib::iterator_traits<I>::value_type> >::type* = 0
0118    /// @endcond
0119    )
0120 {
0121    typedef typename boost::movelib::iterator_traits<I>::value_type input_value_type;
0122 
0123    F back = r;
0124    BOOST_MOVE_TRY{
0125       while (f != l) {
0126          void * const addr = static_cast<void*>(::boost::move_detail::addressof(*r));
0127          ::new(addr) input_value_type(::boost::move(*f));
0128          ++f; ++r;
0129       }
0130    }
0131    BOOST_MOVE_CATCH(...){
0132       for (; back != r; ++back){
0133          boost::movelib::iterator_to_raw_pointer(back)->~input_value_type();
0134       }
0135       BOOST_MOVE_RETHROW;
0136    }
0137    BOOST_MOVE_CATCH_END
0138    return r;
0139 }
0140 
0141 /// @cond
0142 /*
0143 template
0144    <typename I,   // I models InputIterator
0145     typename F>   // F models ForwardIterator
0146 F uninitialized_move(I f, I l, F r,
0147    typename ::boost::move_detail::disable_if<has_move_emulation_enabled<typename boost::movelib::iterator_traits<I>::value_type> >::type* = 0)
0148 {
0149    return std::uninitialized_copy(f, l, r);
0150 }
0151 */
0152 
0153 /// @endcond
0154 
0155 }  //namespace boost {
0156 
0157 #include <boost/move/detail/config_end.hpp>
0158 
0159 #endif //#ifndef BOOST_MOVE_ALGO_MOVE_HPP