1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2012-2012.
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//
8// See http://www.boost.org/libs/move for documentation.
9//
10//////////////////////////////////////////////////////////////////////////////
11
12//! \file
13
14#ifndef BOOST_MOVE_ALGORITHM_HPP
15#define BOOST_MOVE_ALGORITHM_HPP
16
17#ifndef BOOST_CONFIG_HPP
18# include <boost/config.hpp>
19#endif
20#
21#if defined(BOOST_HAS_PRAGMA_ONCE)
22# pragma once
23#endif
24
25#include <boost/move/detail/config_begin.hpp>
26
27#include <boost/move/utility_core.hpp>
28#include <boost/move/iterator.hpp>
29#include <boost/move/algo/move.hpp>
30#include <boost/core/no_exceptions_support.hpp>
31
32#include <algorithm> //copy, copy_backward
33#include <memory> //uninitialized_copy
34
35namespace boost {
36
37//////////////////////////////////////////////////////////////////////////////
38//
39// uninitialized_copy_or_move
40//
41//////////////////////////////////////////////////////////////////////////////
42
43namespace move_detail {
44
45template
46<typename I, // I models InputIterator
47typename F> // F models ForwardIterator
48inline F uninitialized_move_move_iterator(I f, I l, F r
49// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
50)
51{
52 return ::boost::uninitialized_move(f, l, r);
53}
54/*
55template
56<typename I, // I models InputIterator
57typename F> // F models ForwardIterator
58F uninitialized_move_move_iterator(I f, I l, F r,
59 typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
60{
61 return std::uninitialized_copy(f.base(), l.base(), r);
62}
63*/
64} //namespace move_detail {
65
66template
67<typename I, // I models InputIterator
68typename F> // F models ForwardIterator
69inline F uninitialized_copy_or_move(I f, I l, F r,
70 typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
71{
72 return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r);
73}
74
75//////////////////////////////////////////////////////////////////////////////
76//
77// copy_or_move
78//
79//////////////////////////////////////////////////////////////////////////////
80
81namespace move_detail {
82
83template
84<typename I, // I models InputIterator
85typename F> // F models ForwardIterator
86inline F move_move_iterator(I f, I l, F r
87// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
88)
89{
90 return ::boost::move(f, l, r);
91}
92/*
93template
94<typename I, // I models InputIterator
95typename F> // F models ForwardIterator
96F move_move_iterator(I f, I l, F r,
97 typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
98{
99 return std::copy(f.base(), l.base(), r);
100}
101*/
102
103} //namespace move_detail {
104
105template
106<typename I, // I models InputIterator
107typename F> // F models ForwardIterator
108inline F copy_or_move(I f, I l, F r,
109 typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
110{
111 return ::boost::move_detail::move_move_iterator(f, l, r);
112}
113
114/// @endcond
115
116//! <b>Effects</b>:
117//! \code
118//! for (; first != last; ++result, ++first)
119//! new (static_cast<void*>(&*result))
120//! typename iterator_traits<ForwardIterator>::value_type(*first);
121//! \endcode
122//!
123//! <b>Returns</b>: result
124//!
125//! <b>Note</b>: This function is provided because
126//! <i>std::uninitialized_copy</i> from some STL implementations
127//! is not compatible with <i>move_iterator</i>
128template
129<typename I, // I models InputIterator
130typename F> // F models ForwardIterator
131inline F uninitialized_copy_or_move(I f, I l, F r
132 /// @cond
133 ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0
134 /// @endcond
135 )
136{
137 return std::uninitialized_copy(f, l, r);
138}
139
140//! <b>Effects</b>:
141//! \code
142//! for (; first != last; ++result, ++first)
143//! *result = *first;
144//! \endcode
145//!
146//! <b>Returns</b>: result
147//!
148//! <b>Note</b>: This function is provided because
149//! <i>std::uninitialized_copy</i> from some STL implementations
150//! is not compatible with <i>move_iterator</i>
151template
152<typename I, // I models InputIterator
153typename F> // F models ForwardIterator
154inline F copy_or_move(I f, I l, F r
155 /// @cond
156 ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0
157 /// @endcond
158 )
159{
160 return std::copy(f, l, r);
161}
162
163} //namespace boost {
164
165#include <boost/move/detail/config_end.hpp>
166
167#endif //#ifndef BOOST_MOVE_ALGORITHM_HPP
168

source code of include/boost/move/algorithm.hpp