iter_adaptor.hpp
Go to the documentation of this file.
1 /* Copyright 2003-2013 Joaquin M Lopez Munoz.
2  * Distributed under the Boost Software License, Version 1.0.
3  * (See accompanying file LICENSE_1_0.txt or copy at
4  * http://www.boost.org/LICENSE_1_0.txt)
5  *
6  * See http://www.boost.org/libs/multi_index for library home page.
7  */
8 
9 #ifndef BOOST_MULTI_INDEX_DETAIL_ITER_ADAPTOR_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_ITER_ADAPTOR_HPP
11 
12 #if defined(_MSC_VER)
13 #pragma once
14 #endif
15 
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/mpl/apply.hpp>
18 #include <boost/operators.hpp>
19 
20 namespace boost{
21 
22 namespace multi_index{
23 
24 namespace detail{
25 
26 /* Poor man's version of boost::iterator_adaptor. Used instead of the
27  * original as compile times for the latter are significantly higher.
28  * The interface is not replicated exactly, only to the extent necessary
29  * for internal consumption.
30  */
31 
32 /* NB. The purpose of the (non-inclass) global operators ==, < and - defined
33  * above is to partially alleviate a problem of MSVC++ 6.0 by * which
34  * friend-injected operators on T are not visible if T is instantiated only
35  * in template code where T is a dependent type.
36  */
37 
39 {
40 public:
41  template<class Class>
42  static typename Class::reference dereference(const Class& x)
43  {
44  return x.dereference();
45  }
46 
47  template<class Class>
48  static bool equal(const Class& x,const Class& y)
49  {
50  return x.equal(y);
51  }
52 
53  template<class Class>
54  static void increment(Class& x)
55  {
56  x.increment();
57  }
58 
59  template<class Class>
60  static void decrement(Class& x)
61  {
62  x.decrement();
63  }
64 
65  template<class Class>
66  static void advance(Class& x,typename Class::difference_type n)
67  {
68  x.advance(n);
69  }
70 
71  template<class Class>
72  static typename Class::difference_type distance_to(
73  const Class& x,const Class& y)
74  {
75  return x.distance_to(y);
76  }
77 };
78 
79 template<typename Category>
81 
82 template<class Derived,class Base>
85  Derived,
86  typename Base::value_type,
87  typename Base::difference_type,
88  typename Base::pointer,
89  typename Base::reference>
90 {
91 public:
92  typedef typename Base::reference reference;
93 
95  {
96  return iter_adaptor_access::dereference(final());
97  }
98 
99  friend bool operator==(const Derived& x,const Derived& y)
100  {
101  return iter_adaptor_access::equal(x,y);
102  }
103 
104  Derived& operator++()
105  {
107  return final();
108  }
109 
110 private:
111  Derived& final(){return *static_cast<Derived*>(this);}
112  const Derived& final()const{return *static_cast<const Derived*>(this);}
113 };
114 
115 template<class Derived,class Base>
119 {
121  static_cast<const Derived&>(x),static_cast<const Derived&>(y));
122 }
123 
124 template<>
125 struct iter_adaptor_selector<std::forward_iterator_tag>
126 {
127  template<class Derived,class Base>
128  struct apply
129  {
131  };
132 };
133 
134 template<class Derived,class Base>
137  Derived,
138  typename Base::value_type,
139  typename Base::difference_type,
140  typename Base::pointer,
141  typename Base::reference>
142 {
143 public:
144  typedef typename Base::reference reference;
145 
147  {
148  return iter_adaptor_access::dereference(final());
149  }
150 
151  friend bool operator==(const Derived& x,const Derived& y)
152  {
153  return iter_adaptor_access::equal(x,y);
154  }
155 
156  Derived& operator++()
157  {
159  return final();
160  }
161 
162  Derived& operator--()
163  {
165  return final();
166  }
167 
168 private:
169  Derived& final(){return *static_cast<Derived*>(this);}
170  const Derived& final()const{return *static_cast<const Derived*>(this);}
171 };
172 
173 template<class Derived,class Base>
177 {
179  static_cast<const Derived&>(x),static_cast<const Derived&>(y));
180 }
181 
182 template<>
183 struct iter_adaptor_selector<std::bidirectional_iterator_tag>
184 {
185  template<class Derived,class Base>
186  struct apply
187  {
189  };
190 };
191 
192 template<class Derived,class Base>
195  Derived,
196  typename Base::value_type,
197  typename Base::difference_type,
198  typename Base::pointer,
199  typename Base::reference>
200 {
201 public:
202  typedef typename Base::reference reference;
203  typedef typename Base::difference_type difference_type;
204 
206  {
207  return iter_adaptor_access::dereference(final());
208  }
209 
210  friend bool operator==(const Derived& x,const Derived& y)
211  {
212  return iter_adaptor_access::equal(x,y);
213  }
214 
215  friend bool operator<(const Derived& x,const Derived& y)
216  {
217  return iter_adaptor_access::distance_to(x,y)>0;
218  }
219 
220  Derived& operator++()
221  {
223  return final();
224  }
225 
226  Derived& operator--()
227  {
229  return final();
230  }
231 
233  {
234  iter_adaptor_access::advance(final(),n);
235  return final();
236  }
237 
239  {
240  iter_adaptor_access::advance(final(),-n);
241  return final();
242  }
243 
244  friend difference_type operator-(const Derived& x,const Derived& y)
245  {
247  }
248 
249 private:
250  Derived& final(){return *static_cast<Derived*>(this);}
251  const Derived& final()const{return *static_cast<const Derived*>(this);}
252 };
253 
254 template<class Derived,class Base>
258 {
260  static_cast<const Derived&>(x),static_cast<const Derived&>(y));
261 }
262 
263 template<class Derived,class Base>
267 {
269  static_cast<const Derived&>(x),static_cast<const Derived&>(y))>0;
270 }
271 
272 template<class Derived,class Base>
277 {
279  static_cast<const Derived&>(y),static_cast<const Derived&>(x));
280 }
281 
282 template<>
283 struct iter_adaptor_selector<std::random_access_iterator_tag>
284 {
285  template<class Derived,class Base>
286  struct apply
287  {
289  };
290 };
291 
292 template<class Derived,class Base>
294 {
295  typedef iter_adaptor_selector<
296  typename Base::iterator_category> selector;
297  typedef typename mpl::apply2<
299 };
300 
301 template<class Derived,class Base>
302 class iter_adaptor:public iter_adaptor_base<Derived,Base>::type
303 {
304 protected:
306  explicit iter_adaptor(const Base& b_):b(b_){}
307 
308  const Base& base_reference()const{return b;}
309  Base& base_reference(){return b;}
310 
311 private:
313 };
314 
315 } /* namespace multi_index::detail */
316 
317 } /* namespace multi_index */
318 
319 } /* namespace boost */
320 
321 #endif
boost::multi_index::detail::iter_adaptor::base_reference
const Base & base_reference() const
Definition: iter_adaptor.hpp:308
boost::multi_index::detail::random_access_iter_adaptor_base::operator==
friend bool operator==(const Derived &x, const Derived &y)
Definition: iter_adaptor.hpp:210
boost::multi_index::detail::iter_adaptor
Definition: iter_adaptor.hpp:302
boost::multi_index::detail::iter_adaptor::iter_adaptor
iter_adaptor(const Base &b_)
Definition: iter_adaptor.hpp:306
boost::multi_index::detail::forward_iter_adaptor_base::operator==
friend bool operator==(const Derived &x, const Derived &y)
Definition: iter_adaptor.hpp:99
config.hpp
boost::operators_impl::bidirectional_iterator_helper
Definition: operators.hpp:862
boost::multi_index::detail::iter_adaptor_access::dereference
static Class::reference dereference(const Class &x)
Definition: iter_adaptor.hpp:42
boost::multi_index::detail::bidirectional_iter_adaptor_base
Definition: iter_adaptor.hpp:135
boost::type
Definition: type.hpp:14
boost::multi_index::detail::operator-
random_access_iter_adaptor_base< Derived, Base >::difference_type operator-(const random_access_iter_adaptor_base< Derived, Base > &x, const random_access_iter_adaptor_base< Derived, Base > &y)
Definition: iter_adaptor.hpp:274
boost::multi_index::detail::iter_adaptor::iter_adaptor
iter_adaptor()
Definition: iter_adaptor.hpp:305
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::multi_index::detail::operator==
bool operator==(const bidir_node_iterator< Node > &x, const bidir_node_iterator< Node > &y)
Definition: bidir_node_iterator.hpp:101
boost::multi_index::detail::random_access_iter_adaptor_base::operator<
friend bool operator<(const Derived &x, const Derived &y)
Definition: iter_adaptor.hpp:215
boost::multi_index::detail::random_access_iter_adaptor_base::operator-=
Derived & operator-=(difference_type n)
Definition: iter_adaptor.hpp:238
boost::multi_index::detail::iter_adaptor_access::equal
static bool equal(const Class &x, const Class &y)
Definition: iter_adaptor.hpp:48
boost::multi_index::detail::random_access_iter_adaptor_base
Definition: iter_adaptor.hpp:193
boost::multi_index::detail::bidirectional_iter_adaptor_base::reference
Base::reference reference
Definition: iter_adaptor.hpp:144
boost::multi_index::detail::iter_adaptor::b
Base b
Definition: iter_adaptor.hpp:312
boost::operators_impl::random_access_iterator_helper
Definition: operators.hpp:872
boost::mpl::apply2
Definition: aux_/preprocessed/bcc/apply.hpp:67
boost::multi_index::detail::iter_adaptor_access::advance
static void advance(Class &x, typename Class::difference_type n)
Definition: iter_adaptor.hpp:66
Base
boost::multi_index::detail::forward_iter_adaptor_base::reference
Base::reference reference
Definition: iter_adaptor.hpp:92
boost::multi_index::detail::iter_adaptor::base_reference
Base & base_reference()
Definition: iter_adaptor.hpp:309
boost::multi_index::detail::iter_adaptor_access
Definition: iter_adaptor.hpp:38
apply.hpp
boost::multi_index::detail::bidirectional_iter_adaptor_base::operator==
friend bool operator==(const Derived &x, const Derived &y)
Definition: iter_adaptor.hpp:151
boost::multi_index::detail::random_access_iter_adaptor_base::operator++
Derived & operator++()
Definition: iter_adaptor.hpp:220
boost::multi_index::detail::iter_adaptor_access::decrement
static void decrement(Class &x)
Definition: iter_adaptor.hpp:60
boost::multi_index::detail::bidirectional_iter_adaptor_base::operator++
Derived & operator++()
Definition: iter_adaptor.hpp:156
boost::multi_index::detail::random_access_iter_adaptor_base::reference
Base::reference reference
Definition: iter_adaptor.hpp:202
boost::multi_index::detail::iter_adaptor_base::type
mpl::apply2< selector, Derived, Base >::type type
Definition: iter_adaptor.hpp:298
boost::multi_index::detail::iter_adaptor_selector< std::bidirectional_iterator_tag >::apply::type
bidirectional_iter_adaptor_base< Derived, Base > type
Definition: iter_adaptor.hpp:188
boost::multi_index::detail::random_access_iter_adaptor_base::operator*
reference operator*() const
Definition: iter_adaptor.hpp:205
boost::multi_index::detail::iter_adaptor_base::selector
iter_adaptor_selector< typename Base::iterator_category > selector
Definition: iter_adaptor.hpp:296
boost::multi_index::detail::random_access_iter_adaptor_base::operator-
friend difference_type operator-(const Derived &x, const Derived &y)
Definition: iter_adaptor.hpp:244
boost::multi_index::detail::iter_adaptor_access::distance_to
static Class::difference_type distance_to(const Class &x, const Class &y)
Definition: iter_adaptor.hpp:72
boost::operators_impl::forward_iterator_helper
Definition: operators.hpp:852
std
boost::multi_index::detail::forward_iter_adaptor_base::operator*
reference operator*() const
Definition: iter_adaptor.hpp:94
boost::multi_index::detail::iter_adaptor_selector< std::random_access_iterator_tag >::apply::type
random_access_iter_adaptor_base< Derived, Base > type
Definition: iter_adaptor.hpp:288
boost::multi_index::detail::bidirectional_iter_adaptor_base::operator--
Derived & operator--()
Definition: iter_adaptor.hpp:162
boost::multi_index::detail::iter_adaptor_base
Definition: iter_adaptor.hpp:293
operators.hpp
boost::multi_index::detail::iter_adaptor_access::increment
static void increment(Class &x)
Definition: iter_adaptor.hpp:54
boost::multi_index::detail::forward_iter_adaptor_base
Definition: iter_adaptor.hpp:83
boost::multi_index::detail::random_access_iter_adaptor_base::difference_type
Base::difference_type difference_type
Definition: iter_adaptor.hpp:203
boost::multi_index::detail::forward_iter_adaptor_base::operator++
Derived & operator++()
Definition: iter_adaptor.hpp:104
boost::multi_index::detail::bidirectional_iter_adaptor_base::operator*
reference operator*() const
Definition: iter_adaptor.hpp:146
boost::multi_index::detail::random_access_iter_adaptor_base::operator--
Derived & operator--()
Definition: iter_adaptor.hpp:226
boost::multi_index::detail::iter_adaptor_selector< std::forward_iterator_tag >::apply::type
forward_iter_adaptor_base< Derived, Base > type
Definition: iter_adaptor.hpp:130
boost::multi_index::detail::random_access_iter_adaptor_base::operator+=
Derived & operator+=(difference_type n)
Definition: iter_adaptor.hpp:232
boost::multi_index::detail::iter_adaptor_selector
Definition: iter_adaptor.hpp:80
boost::multi_index::detail::operator<
bool operator<(const random_access_iter_adaptor_base< Derived, Base > &x, const random_access_iter_adaptor_base< Derived, Base > &y)
Definition: iter_adaptor.hpp:264


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:40:05