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