Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2012-2012.
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_ALGORITHM_HPP
0015 #define BOOST_MOVE_ALGORITHM_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/iterator.hpp>
0029 #include <boost/move/algo/move.hpp>
0030 
0031 #include <algorithm> //copy, copy_backward
0032 #include <memory>    //uninitialized_copy
0033 
0034 namespace boost {
0035 
0036 //////////////////////////////////////////////////////////////////////////////
0037 //
0038 //                            uninitialized_copy_or_move
0039 //
0040 //////////////////////////////////////////////////////////////////////////////
0041 
0042 namespace move_detail {
0043 
0044 template
0045 <typename I,   // I models InputIterator
0046 typename F>   // F models ForwardIterator
0047 inline F uninitialized_move_move_iterator(I f, I l, F r
0048 //                             ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
0049 )
0050 {
0051    return ::boost::uninitialized_move(f, l, r);
0052 }
0053 /*
0054 template
0055 <typename I,   // I models InputIterator
0056 typename F>   // F models ForwardIterator
0057 F uninitialized_move_move_iterator(I f, I l, F r,
0058                                    typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
0059 {
0060    return std::uninitialized_copy(f.base(), l.base(), r);
0061 }
0062 */
0063 }  //namespace move_detail {
0064 
0065 template
0066 <typename I,   // I models InputIterator
0067 typename F>   // F models ForwardIterator
0068 inline F uninitialized_copy_or_move(I f, I l, F r,
0069                              typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
0070 {
0071    return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r);
0072 }
0073 
0074 //////////////////////////////////////////////////////////////////////////////
0075 //
0076 //                            copy_or_move
0077 //
0078 //////////////////////////////////////////////////////////////////////////////
0079 
0080 namespace move_detail {
0081 
0082 template
0083 <typename I,   // I models InputIterator
0084 typename F>   // F models ForwardIterator
0085 inline F move_move_iterator(I f, I l, F r
0086 //                             ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
0087 )
0088 {
0089    return ::boost::move(f, l, r);
0090 }
0091 /*
0092 template
0093 <typename I,   // I models InputIterator
0094 typename F>   // F models ForwardIterator
0095 F move_move_iterator(I f, I l, F r,
0096                                    typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
0097 {
0098    return std::copy(f.base(), l.base(), r);
0099 }
0100 */
0101 
0102 }  //namespace move_detail {
0103 
0104 template
0105 <typename I,   // I models InputIterator
0106 typename F>   // F models ForwardIterator
0107 inline F copy_or_move(I f, I l, F r,
0108                              typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
0109 {
0110    return ::boost::move_detail::move_move_iterator(f, l, r);
0111 }
0112 
0113 /// @endcond
0114 
0115 //! <b>Effects</b>:
0116 //!   \code
0117 //!   for (; first != last; ++result, ++first)
0118 //!      new (static_cast<void*>(&*result))
0119 //!         typename iterator_traits<ForwardIterator>::value_type(*first);
0120 //!   \endcode
0121 //!
0122 //! <b>Returns</b>: result
0123 //!
0124 //! <b>Note</b>: This function is provided because
0125 //!   <i>std::uninitialized_copy</i> from some STL implementations
0126 //!    is not compatible with <i>move_iterator</i>
0127 template
0128 <typename I,   // I models InputIterator
0129 typename F>   // F models ForwardIterator
0130 inline F uninitialized_copy_or_move(I f, I l, F r
0131    /// @cond
0132    ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0
0133    /// @endcond
0134    )
0135 {
0136    return std::uninitialized_copy(f, l, r);
0137 }
0138 
0139 //! <b>Effects</b>:
0140 //!   \code
0141 //!   for (; first != last; ++result, ++first)
0142 //!      *result = *first;
0143 //!   \endcode
0144 //!
0145 //! <b>Returns</b>: result
0146 //!
0147 //! <b>Note</b>: This function is provided because
0148 //!   <i>std::uninitialized_copy</i> from some STL implementations
0149 //!    is not compatible with <i>move_iterator</i>
0150 template
0151 <typename I,   // I models InputIterator
0152 typename F>   // F models ForwardIterator
0153 inline F copy_or_move(I f, I l, F r
0154    /// @cond
0155    ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0
0156    /// @endcond
0157    )
0158 {
0159    return std::copy(f, l, r);
0160 }
0161 
0162 }  //namespace boost {
0163 
0164 #include <boost/move/detail/config_end.hpp>
0165 
0166 #endif //#ifndef BOOST_MOVE_ALGORITHM_HPP