summaryrefslogtreecommitdiffstats
path: root/contrib/src/boost/move/algorithm.hpp
blob: 8354e8d0251d0d76d0c536ddd070c395e10cf32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
//////////////////////////////////////////////////////////////////////////////

//

// (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 <boost/config.hpp>

#endif

#

#if defined(BOOST_HAS_PRAGMA_ONCE)

#  pragma once

#endif


#include <boost/move/detail/config_begin.hpp>


#include <boost/move/utility_core.hpp>

#include <boost/move/iterator.hpp>

#include <boost/move/algo/move.hpp>

#include <boost/detail/no_exceptions_support.hpp>


#include <algorithm> //copy, copy_backward

#include <memory>    //uninitialized_copy


namespace boost {

//////////////////////////////////////////////////////////////////////////////

//

//                            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_ALGORITHM_HPP