comparison DEPENDENCIES/generic/include/boost/move/iterator.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
12 //! \file 12 //! \file
13 13
14 #ifndef BOOST_MOVE_ITERATOR_HPP 14 #ifndef BOOST_MOVE_ITERATOR_HPP
15 #define BOOST_MOVE_ITERATOR_HPP 15 #define BOOST_MOVE_ITERATOR_HPP
16 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
17 #include <boost/move/detail/config_begin.hpp> 25 #include <boost/move/detail/config_begin.hpp>
18 #include <boost/move/utility.hpp> 26 #include <boost/move/detail/iterator_traits.hpp>
19 #include <iterator> //std::iterator 27 #include <boost/move/utility_core.hpp>
20 28
21 namespace boost { 29 namespace boost {
22 30
23 ////////////////////////////////////////////////////////////////////////////// 31 //////////////////////////////////////////////////////////////////////////////
24 // 32 //
34 template <class It> 42 template <class It>
35 class move_iterator 43 class move_iterator
36 { 44 {
37 public: 45 public:
38 typedef It iterator_type; 46 typedef It iterator_type;
39 typedef typename std::iterator_traits<iterator_type>::value_type value_type; 47 typedef typename boost::movelib::iterator_traits<iterator_type>::value_type value_type;
40 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED) 48 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED)
41 typedef value_type && reference; 49 typedef value_type && reference;
42 #else 50 #else
43 typedef typename ::boost::move_detail::if_ 51 typedef typename ::boost::move_detail::if_
44 < ::boost::has_move_emulation_enabled<value_type> 52 < ::boost::has_move_emulation_enabled<value_type>
45 , ::boost::rv<value_type>& 53 , ::boost::rv<value_type>&
46 , value_type & >::type reference; 54 , value_type & >::type reference;
47 #endif 55 #endif
48 typedef It pointer; 56 typedef It pointer;
49 typedef typename std::iterator_traits<iterator_type>::difference_type difference_type; 57 typedef typename boost::movelib::iterator_traits<iterator_type>::difference_type difference_type;
50 typedef typename std::iterator_traits<iterator_type>::iterator_category iterator_category; 58 typedef typename boost::movelib::iterator_traits<iterator_type>::iterator_category iterator_category;
51 59
52 move_iterator() 60 move_iterator()
53 {} 61 {}
54 62
55 explicit move_iterator(It i) 63 explicit move_iterator(It i)
140 //is_move_iterator 148 //is_move_iterator
141 namespace move_detail { 149 namespace move_detail {
142 150
143 template <class I> 151 template <class I>
144 struct is_move_iterator 152 struct is_move_iterator
145 : public ::boost::move_detail::integral_constant<bool, false> 153 {
146 { 154 static const bool value = false;
147 }; 155 };
148 156
149 template <class I> 157 template <class I>
150 struct is_move_iterator< ::boost::move_iterator<I> > 158 struct is_move_iterator< ::boost::move_iterator<I> >
151 : public ::boost::move_detail::integral_constant<bool, true> 159 {
152 { 160 static const bool value = true;
153 }; 161 };
154 162
155 } //namespace move_detail { 163 } //namespace move_detail {
156 164
157 ////////////////////////////////////////////////////////////////////////////// 165 //////////////////////////////////////////////////////////////////////////////
175 183
176 //! A move insert iterator that move constructs elements at the 184 //! A move insert iterator that move constructs elements at the
177 //! back of a container 185 //! back of a container
178 template <typename C> // C models Container 186 template <typename C> // C models Container
179 class back_move_insert_iterator 187 class back_move_insert_iterator
180 : public std::iterator<std::output_iterator_tag, void, void, void, void>
181 { 188 {
182 C* container_m; 189 C* container_m;
183 190
184 public: 191 public:
185 typedef C container_type; 192 typedef C container_type;
186 typedef typename C::value_type value_type; 193 typedef typename C::value_type value_type;
187 typedef typename C::reference reference; 194 typedef typename C::reference reference;
195 typedef typename C::pointer pointer;
196 typedef typename C::difference_type difference_type;
197 typedef std::output_iterator_tag iterator_category;
188 198
189 explicit back_move_insert_iterator(C& x) : container_m(&x) { } 199 explicit back_move_insert_iterator(C& x) : container_m(&x) { }
190 200
191 back_move_insert_iterator& operator=(reference x) 201 back_move_insert_iterator& operator=(reference x)
192 { container_m->push_back(boost::move(x)); return *this; } 202 { container_m->push_back(boost::move(x)); return *this; }
215 225
216 //! A move insert iterator that move constructs elements int the 226 //! A move insert iterator that move constructs elements int the
217 //! front of a container 227 //! front of a container
218 template <typename C> // C models Container 228 template <typename C> // C models Container
219 class front_move_insert_iterator 229 class front_move_insert_iterator
220 : public std::iterator<std::output_iterator_tag, void, void, void, void>
221 { 230 {
222 C* container_m; 231 C* container_m;
223 232
224 public: 233 public:
225 typedef C container_type; 234 typedef C container_type;
226 typedef typename C::value_type value_type; 235 typedef typename C::value_type value_type;
227 typedef typename C::reference reference; 236 typedef typename C::reference reference;
237 typedef typename C::pointer pointer;
238 typedef typename C::difference_type difference_type;
239 typedef std::output_iterator_tag iterator_category;
228 240
229 explicit front_move_insert_iterator(C& x) : container_m(&x) { } 241 explicit front_move_insert_iterator(C& x) : container_m(&x) { }
230 242
231 front_move_insert_iterator& operator=(reference x) 243 front_move_insert_iterator& operator=(reference x)
232 { container_m->push_front(boost::move(x)); return *this; } 244 { container_m->push_front(boost::move(x)); return *this; }
252 // insert_move_iterator 264 // insert_move_iterator
253 // 265 //
254 ////////////////////////////////////////////////////////////////////////////// 266 //////////////////////////////////////////////////////////////////////////////
255 template <typename C> // C models Container 267 template <typename C> // C models Container
256 class move_insert_iterator 268 class move_insert_iterator
257 : public std::iterator<std::output_iterator_tag, void, void, void, void>
258 { 269 {
259 C* container_m; 270 C* container_m;
260 typename C::iterator pos_; 271 typename C::iterator pos_;
261 272
262 public: 273 public:
263 typedef C container_type; 274 typedef C container_type;
264 typedef typename C::value_type value_type; 275 typedef typename C::value_type value_type;
265 typedef typename C::reference reference; 276 typedef typename C::reference reference;
277 typedef typename C::pointer pointer;
278 typedef typename C::difference_type difference_type;
279 typedef std::output_iterator_tag iterator_category;
266 280
267 explicit move_insert_iterator(C& x, typename C::iterator pos) 281 explicit move_insert_iterator(C& x, typename C::iterator pos)
268 : container_m(&x), pos_(pos) 282 : container_m(&x), pos_(pos)
269 {} 283 {}
270 284