]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/move/algo/move.hpp
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / boost / move / algo / move.hpp
CommitLineData
7c673cae
FG
1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2012-2016.
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_ALGO_MOVE_HPP
15#define BOOST_MOVE_ALGO_MOVE_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/detail/iterator_traits.hpp>
b32b8144 29#include <boost/move/detail/iterator_to_raw_pointer.hpp>
1e59de90 30#include <boost/move/detail/addressof.hpp>
92f5a8d4 31#include <boost/core/no_exceptions_support.hpp>
1e59de90
TL
32#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
33#include <algorithm>
34#endif
7c673cae
FG
35
36namespace boost {
37
38//////////////////////////////////////////////////////////////////////////////
39//
40// move
41//
42//////////////////////////////////////////////////////////////////////////////
43
44#if !defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
45
46 //! <b>Effects</b>: Moves elements in the range [first,last) into the range [result,result + (last -
47 //! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first),
48 //! performs *(result + n) = ::boost::move (*(first + n)).
49 //!
50 //! <b>Effects</b>: result + (last - first).
51 //!
52 //! <b>Requires</b>: result shall not be in the range [first,last).
53 //!
54 //! <b>Complexity</b>: Exactly last - first move assignments.
55 template <typename I, // I models InputIterator
56 typename O> // O models OutputIterator
57 O move(I f, I l, O result)
58 {
59 while (f != l) {
60 *result = ::boost::move(*f);
61 ++f; ++result;
62 }
63 return result;
64 }
65
66 //////////////////////////////////////////////////////////////////////////////
67 //
68 // move_backward
69 //
70 //////////////////////////////////////////////////////////////////////////////
71
72 //! <b>Effects</b>: Moves elements in the range [first,last) into the range
73 //! [result - (last-first),result) starting from last - 1 and proceeding to
74 //! first. For each positive integer n <= (last - first),
75 //! performs *(result - n) = ::boost::move(*(last - n)).
76 //!
77 //! <b>Requires</b>: result shall not be in the range [first,last).
78 //!
79 //! <b>Returns</b>: result - (last - first).
80 //!
81 //! <b>Complexity</b>: Exactly last - first assignments.
82 template <typename I, // I models BidirectionalIterator
83 typename O> // O models BidirectionalIterator
84 O move_backward(I f, I l, O result)
85 {
86 while (f != l) {
87 --l; --result;
88 *result = ::boost::move(*l);
89 }
90 return result;
91 }
92
93#else
94
95 using ::std::move_backward;
96
97#endif //!defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
98
99//////////////////////////////////////////////////////////////////////////////
100//
101// uninitialized_move
102//
103//////////////////////////////////////////////////////////////////////////////
104
105//! <b>Effects</b>:
106//! \code
107//! for (; first != last; ++result, ++first)
108//! new (static_cast<void*>(&*result))
109//! typename iterator_traits<ForwardIterator>::value_type(boost::move(*first));
110//! \endcode
111//!
112//! <b>Returns</b>: result
113template
114 <typename I, // I models InputIterator
115 typename F> // F models ForwardIterator
116F uninitialized_move(I f, I l, F r
117 /// @cond
118// ,typename ::boost::move_detail::enable_if<has_move_emulation_enabled<typename boost::movelib::iterator_traits<I>::value_type> >::type* = 0
119 /// @endcond
120 )
121{
122 typedef typename boost::movelib::iterator_traits<I>::value_type input_value_type;
123
124 F back = r;
125 BOOST_TRY{
126 while (f != l) {
127 void * const addr = static_cast<void*>(::boost::move_detail::addressof(*r));
128 ::new(addr) input_value_type(::boost::move(*f));
129 ++f; ++r;
130 }
131 }
132 BOOST_CATCH(...){
133 for (; back != r; ++back){
b32b8144 134 boost::movelib::iterator_to_raw_pointer(back)->~input_value_type();
7c673cae
FG
135 }
136 BOOST_RETHROW;
137 }
138 BOOST_CATCH_END
139 return r;
140}
141
142/// @cond
143/*
144template
145 <typename I, // I models InputIterator
146 typename F> // F models ForwardIterator
147F uninitialized_move(I f, I l, F r,
148 typename ::boost::move_detail::disable_if<has_move_emulation_enabled<typename boost::movelib::iterator_traits<I>::value_type> >::type* = 0)
149{
150 return std::uninitialized_copy(f, l, r);
151}
152*/
153
154/// @endcond
155
156} //namespace boost {
157
158#include <boost/move/detail/config_end.hpp>
159
160#endif //#ifndef BOOST_MOVE_ALGO_MOVE_HPP