iterator_facade.hpp
Go to the documentation of this file.
1 // (C) Copyright David Abrahams 2002.
2 // (C) Copyright Jeremy Siek 2002.
3 // (C) Copyright Thomas Witt 2002.
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 #ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP
8 #define BOOST_ITERATOR_FACADE_23022003THW_HPP
9 
10 #include <boost/config.hpp>
11 #include <boost/iterator.hpp>
15 
18 
19 #include <boost/static_assert.hpp>
21 
30 
31 #include <boost/mpl/eval_if.hpp>
32 #include <boost/mpl/if.hpp>
33 #include <boost/mpl/or.hpp>
34 #include <boost/mpl/and.hpp>
35 #include <boost/mpl/not.hpp>
36 #include <boost/mpl/always.hpp>
37 #include <boost/mpl/apply.hpp>
38 #include <boost/mpl/identity.hpp>
39 
40 #include <boost/iterator/detail/config_def.hpp> // this goes last
41 
42 namespace boost {
43 namespace iterators {
44 
45  // This forward declaration is required for the friend declaration
46  // in iterator_core_access
47  template <class I, class V, class TC, class R, class D> class iterator_facade;
48 
49  namespace detail
50  {
51  // A binary metafunction class that always returns bool. VC6
52  // ICEs on mpl::always<bool>, probably because of the default
53  // parameters.
54  struct always_bool2
55  {
56  template <class T, class U>
57  struct apply
58  {
59  typedef bool type;
60  };
61  };
62 
63  // The type trait checks if the category or traversal is at least as advanced as the specified required traversal
64  template< typename CategoryOrTraversal, typename Required >
66  public boost::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required >
67  {};
68 
69  //
70  // enable if for use in operator implementation.
71  //
72  template <
73  class Facade1
74  , class Facade2
75  , class Return
76  >
79  is_interoperable< Facade1, Facade2 >
80  , Return
81  >
82  {};
83 
84  //
85  // enable if for use in implementation of operators specific for random access traversal.
86  //
87  template <
88  class Facade1
89  , class Facade2
90  , class Return
91  >
94  mpl::and_<
95  is_interoperable< Facade1, Facade2 >
96  , is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag >
97  , is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag >
98  >
99  , Return
100  >
101  {};
102 
103  //
104  // Generates associated types for an iterator_facade with the
105  // given parameters.
106  //
107  template <
108  class ValueParam
109  , class CategoryOrTraversal
110  , class Reference
111  , class Difference
112  >
114  {
115  typedef typename facade_iterator_category<
116  CategoryOrTraversal, ValueParam, Reference
118 
120 
121  // Not the real associated pointer type
122  typedef typename mpl::eval_if<
127 
128 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
129  && (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \
130  || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \
131  || BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \
132  || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310)
133 
134  // To interoperate with some broken library/compiler
135  // combinations, user-defined iterators must be derived from
136  // std::iterator. It is possible to implement a standard
137  // library for broken compilers without this limitation.
138 # define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1
139 
140  typedef
141  iterator<iterator_category, value_type, Difference, pointer, Reference>
142  base;
143 # endif
144  };
145 
146  // iterators whose dereference operators reference the same value
147  // for all iterators into the same sequence (like many input
148  // iterators) need help with their postfix ++: the referenced
149  // value must be read and stored away before the increment occurs
150  // so that *a++ yields the originally referenced element and not
151  // the next one.
152  template <class Iterator>
154  {
156  public:
157  explicit postfix_increment_proxy(Iterator const& x)
158  : stored_value(*x)
159  {}
160 
161  // Returning a mutable reference allows nonsense like
162  // (*r++).mutate(), but it imposes fewer assumptions about the
163  // behavior of the value_type. In particular, recall that
164  // (*r).mutate() is legal if operator* returns by value.
165  value_type&
166  operator*() const
167  {
168  return this->stored_value;
169  }
170  private:
171  mutable value_type stored_value;
172  };
173 
174  //
175  // In general, we can't determine that such an iterator isn't
176  // writable -- we also need to store a copy of the old iterator so
177  // that it can be written into.
178  template <class Iterator>
180  {
182  public:
183  explicit writable_postfix_increment_proxy(Iterator const& x)
184  : stored_value(*x)
185  , stored_iterator(x)
186  {}
187 
188  // Dereferencing must return a proxy so that both *r++ = o and
189  // value_type(*r++) can work. In this case, *r is the same as
190  // *r++, and the conversion operator below is used to ensure
191  // readability.
193  operator*() const
194  {
195  return *this;
196  }
197 
198  // Provides readability of *r++
199  operator value_type&() const
200  {
201  return stored_value;
202  }
203 
204  // Provides writability of *r++
205  template <class T>
206  T const& operator=(T const& x) const
207  {
208  *this->stored_iterator = x;
209  return x;
210  }
211 
212  // This overload just in case only non-const objects are writable
213  template <class T>
214  T& operator=(T& x) const
215  {
216  *this->stored_iterator = x;
217  return x;
218  }
219 
220  // Provides X(r++)
221  operator Iterator const&() const
222  {
223  return stored_iterator;
224  }
225 
226  private:
228  Iterator stored_iterator;
229  };
230 
231 # ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
232 
233  template <class Reference, class Value>
234  struct is_non_proxy_reference_impl
235  {
236  static Reference r;
237 
238  template <class R>
239  static typename mpl::if_<
241  R const volatile*
242  , Value const volatile*
243  >
244  , char[1]
245  , char[2]
246  >::type& helper(R const&);
247 
248  BOOST_STATIC_CONSTANT(bool, value = sizeof(helper(r)) == 1);
249  };
250 
251  template <class Reference, class Value>
252  struct is_non_proxy_reference
253  : mpl::bool_<
254  is_non_proxy_reference_impl<Reference, Value>::value
255  >
256  {};
257 # else
258  template <class Reference, class Value>
260  : is_convertible<
261  typename remove_reference<Reference>::type
262  const volatile*
263  , Value const volatile*
264  >
265  {};
266 # endif
267 
268  // A metafunction to choose the result type of postfix ++
269  //
270  // Because the C++98 input iterator requirements say that *r++ has
271  // type T (value_type), implementations of some standard
272  // algorithms like lexicographical_compare may use constructions
273  // like:
274  //
275  // *r++ < *s++
276  //
277  // If *r++ returns a proxy (as required if r is writable but not
278  // multipass), this sort of expression will fail unless the proxy
279  // supports the operator<. Since there are any number of such
280  // operations, we're not going to try to support them. Therefore,
281  // even if r++ returns a proxy, *r++ will only return a proxy if
282  // *r also returns a proxy.
283  template <class Iterator, class Value, class Reference, class CategoryOrTraversal>
285  : mpl::eval_if<
286  mpl::and_<
287  // A proxy is only needed for readable iterators
288  is_convertible<
289  Reference
290  // Use add_lvalue_reference to form `reference to Value` due to
291  // some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject
292  // 'reference-to-reference' in the template which described in CWG
293  // DR106.
294  // http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106
295  , typename add_lvalue_reference<Value const>::type
296  >
297 
298  // No multipass iterator can have values that disappear
299  // before positions can be re-visited
300  , mpl::not_<
301  is_convertible<
302  typename iterator_category_to_traversal<CategoryOrTraversal>::type
303  , forward_traversal_tag
304  >
305  >
306  >
307  , mpl::if_<
308  is_non_proxy_reference<Reference,Value>
309  , postfix_increment_proxy<Iterator>
310  , writable_postfix_increment_proxy<Iterator>
311  >
312  , mpl::identity<Iterator>
313  >
314  {};
315 
316  // operator->() needs special support for input iterators to strictly meet the
317  // standard's requirements. If *i is not a reference type, we must still
318  // produce an lvalue to which a pointer can be formed. We do that by
319  // returning a proxy object containing an instance of the reference object.
320  template <class Reference, class Pointer>
321  struct operator_arrow_dispatch // proxy references
322  {
323  struct proxy
324  {
325  explicit proxy(Reference const & x) : m_ref(x) {}
326  Reference* operator->() { return boost::addressof(m_ref); }
327  // This function is needed for MWCW and BCC, which won't call
328  // operator-> again automatically per 13.3.1.2 para 8
329  operator Reference*() { return boost::addressof(m_ref); }
330  Reference m_ref;
331  };
333  static result_type apply(Reference const & x)
334  {
335  return result_type(x);
336  }
337  };
338 
339  template <class T, class Pointer>
340  struct operator_arrow_dispatch<T&, Pointer> // "real" references
341  {
342  typedef Pointer result_type;
343  static result_type apply(T& x)
344  {
345  return boost::addressof(x);
346  }
347  };
348 
349  // A proxy return type for operator[], needed to deal with
350  // iterators that may invalidate referents upon destruction.
351  // Consider the temporary iterator in *(a + n)
352  template <class Iterator>
354  {
355  // Iterator is actually an iterator_facade, so we do not have to
356  // go through iterator_traits to access the traits.
357  typedef typename Iterator::reference reference;
358  typedef typename Iterator::value_type value_type;
359 
360  public:
361  operator_brackets_proxy(Iterator const& iter)
362  : m_iter(iter)
363  {}
364 
365  operator reference() const
366  {
367  return *m_iter;
368  }
369 
371  {
372  *m_iter = val;
373  return *this;
374  }
375 
376  private:
377  Iterator m_iter;
378  };
379 
380  // A metafunction that determines whether operator[] must return a
381  // proxy, or whether it can simply return a copy of the value_type.
382  template <class ValueType, class Reference>
384  : mpl::not_<
385  mpl::and_<
386  // Really we want an is_copy_constructible trait here,
387  // but is_POD will have to suffice in the meantime.
388  boost::is_POD<ValueType>
389  , iterator_writability_disabled<ValueType,Reference>
390  >
391  >
392  {};
393 
394  template <class Iterator, class Value, class Reference>
396  {
397  typedef typename mpl::if_<
400  , Value
402  };
403 
404  template <class Iterator>
406  {
408  }
409 
410  template <class Iterator>
411  typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_)
412  {
413  return *iter;
414  }
415 
417  {
418  template <class I1, class I2>
419  struct apply
420  :
421 # ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
423 # else
424  mpl::eval_if<
425  is_convertible<I2,I1>
426  , iterator_difference<I1>
427  , iterator_difference<I2>
428  >
429 # endif
430  {};
431 
432  };
433 
434  template <
435  class Derived
436  , class Value
437  , class CategoryOrTraversal
438  , class Reference
439  , class Difference
440  , bool IsBidirectionalTraversal
441  , bool IsRandomAccessTraversal
442  >
444 
445  } // namespace detail
446 
447 
448  // Macros which describe the declarations of binary operators
449 # ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY
450 # define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
451  template < \
452  class Derived1, class V1, class TC1, class Reference1, class Difference1 \
453  , class Derived2, class V2, class TC2, class Reference2, class Difference2 \
454  > \
455  prefix typename mpl::apply2<result_type,Derived1,Derived2>::type \
456  operator op( \
457  iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
458  , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
459 # else
460 # define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \
461  template < \
462  class Derived1, class V1, class TC1, class Reference1, class Difference1 \
463  , class Derived2, class V2, class TC2, class Reference2, class Difference2 \
464  > \
465  prefix typename enabler< \
466  Derived1, Derived2 \
467  , typename mpl::apply2<result_type,Derived1,Derived2>::type \
468  >::type \
469  operator op( \
470  iterator_facade<Derived1, V1, TC1, Reference1, Difference1> const& lhs \
471  , iterator_facade<Derived2, V2, TC2, Reference2, Difference2> const& rhs)
472 # endif
473 
474 # define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \
475  BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable)
476 
477 # define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(prefix, op, result_type) \
478  BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable_and_random_access_traversal)
479 
480 # define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \
481  template <class Derived, class V, class TC, class R, class D> \
482  prefix typename boost::iterators::enable_if< \
483  boost::iterators::detail::is_traversal_at_least< TC, boost::iterators::random_access_traversal_tag >, \
484  Derived \
485  >::type operator+ args
486 
487  //
488  // Helper class for granting access to the iterator core interface.
489  //
490  // The simple core interface is used by iterator_facade. The core
491  // interface of a user/library defined iterator type should not be made public
492  // so that it does not clutter the public interface. Instead iterator_core_access
493  // should be made friend so that iterator_facade can access the core
494  // interface through iterator_core_access.
495  //
497  {
498 # if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
499  // Tasteless as this may seem, making all members public allows member templates
500  // to work in the absence of member template friends.
501  public:
502 # else
503 
504  template <class I, class V, class TC, class R, class D> friend class iterator_facade;
505  template <class I, class V, class TC, class R, class D, bool IsBidirectionalTraversal, bool IsRandomAccessTraversal>
507 
508 # define BOOST_ITERATOR_FACADE_RELATION(op) \
509  BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::iterators::detail::always_bool2);
510 
513 
514 # undef BOOST_ITERATOR_FACADE_RELATION
515 
516 # define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op) \
517  BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::iterators::detail::always_bool2);
518 
523 
524 # undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
525 
528  ;
529 
531  friend inline
533  , typename Derived::difference_type)
534  )
535  ;
536 
538  friend inline
539  , (typename Derived::difference_type
541  )
542  ;
543 
544 # endif
545 
546  template <class Facade>
547  static typename Facade::reference dereference(Facade const& f)
548  {
549  return f.dereference();
550  }
551 
552  template <class Facade>
553  static void increment(Facade& f)
554  {
555  f.increment();
556  }
557 
558  template <class Facade>
559  static void decrement(Facade& f)
560  {
561  f.decrement();
562  }
563 
564  template <class Facade1, class Facade2>
565  static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_)
566  {
567  return f1.equal(f2);
568  }
569 
570  template <class Facade1, class Facade2>
571  static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_)
572  {
573  return f2.equal(f1);
574  }
575 
576  template <class Facade>
577  static void advance(Facade& f, typename Facade::difference_type n)
578  {
579  f.advance(n);
580  }
581 
582  template <class Facade1, class Facade2>
583  static typename Facade1::difference_type distance_from(
584  Facade1 const& f1, Facade2 const& f2, mpl::true_)
585  {
586  return -f1.distance_to(f2);
587  }
588 
589  template <class Facade1, class Facade2>
590  static typename Facade2::difference_type distance_from(
591  Facade1 const& f1, Facade2 const& f2, mpl::false_)
592  {
593  return f2.distance_to(f1);
594  }
595 
596  //
597  // Curiously Recurring Template interface.
598  //
599  template <class I, class V, class TC, class R, class D>
601  {
602  return *static_cast<I*>(&facade);
603  }
604 
605  template <class I, class V, class TC, class R, class D>
606  static I const& derived(iterator_facade<I,V,TC,R,D> const& facade)
607  {
608  return *static_cast<I const*>(&facade);
609  }
610 
611  // objects of this class are useless
613  };
614 
615  namespace detail {
616 
617  // Implementation for forward traversal iterators
618  template <
619  class Derived
620  , class Value
621  , class CategoryOrTraversal
622  , class Reference
623  , class Difference
624  >
625  class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
626 # ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
628  Value, CategoryOrTraversal, Reference, Difference
629  >::base
630 # undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE
631 # endif
632  {
633  private:
635  Value, CategoryOrTraversal, Reference, Difference
637 
639  Reference
640  , typename associated_types::pointer
642 
643  public:
645  typedef Reference reference;
646  typedef Difference difference_type;
647 
649 
651 
652  public:
654  {
655  return iterator_core_access::dereference(this->derived());
656  }
657 
659  {
660  return operator_arrow_dispatch_::apply(*this->derived());
661  }
662 
663  Derived& operator++()
664  {
665  iterator_core_access::increment(this->derived());
666  return this->derived();
667  }
668 
669  protected:
670  //
671  // Curiously Recurring Template interface.
672  //
673  Derived& derived()
674  {
675  return *static_cast<Derived*>(this);
676  }
677 
678  Derived const& derived() const
679  {
680  return *static_cast<Derived const*>(this);
681  }
682  };
683 
684  // Implementation for bidirectional traversal iterators
685  template <
686  class Derived
687  , class Value
688  , class CategoryOrTraversal
689  , class Reference
690  , class Difference
691  >
692  class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > :
693  public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >
694  {
695  public:
696  Derived& operator--()
697  {
698  iterator_core_access::decrement(this->derived());
699  return this->derived();
700  }
701 
702  Derived operator--(int)
703  {
704  Derived tmp(this->derived());
705  --*this;
706  return tmp;
707  }
708  };
709 
710  // Implementation for random access traversal iterators
711  template <
712  class Derived
713  , class Value
714  , class CategoryOrTraversal
715  , class Reference
716  , class Difference
717  >
718  class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true > :
719  public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false >
720  {
721  private:
723 
724  public:
725  typedef typename base_type::reference reference;
727 
728  public:
731  {
733 
734  return boost::iterators::detail::make_operator_brackets_result<Derived>(
735  this->derived() + n
736  , use_proxy()
737  );
738  }
739 
741  {
742  iterator_core_access::advance(this->derived(), n);
743  return this->derived();
744  }
745 
747  {
748  iterator_core_access::advance(this->derived(), -n);
749  return this->derived();
750  }
751 
752  Derived operator-(difference_type x) const
753  {
754  Derived result(this->derived());
755  return result -= x;
756  }
757  };
758 
759  } // namespace detail
760 
761  //
762  // iterator_facade - use as a public base class for defining new
763  // standard-conforming iterators.
764  //
765  template <
766  class Derived // The derived iterator type being constructed
767  , class Value
768  , class CategoryOrTraversal
769  , class Reference = Value&
770  , class Difference = std::ptrdiff_t
771  >
772  class iterator_facade :
773  public detail::iterator_facade_base<
774  Derived,
775  Value,
776  CategoryOrTraversal,
777  Reference,
778  Difference,
779  detail::is_traversal_at_least< CategoryOrTraversal, bidirectional_traversal_tag >::value,
780  detail::is_traversal_at_least< CategoryOrTraversal, random_access_traversal_tag >::value
781  >
782  {
783  protected:
784  // For use by derived classes
786  };
787 
788  template <class I, class V, class TC, class R, class D>
792  , int
793  )
794  {
796  tmp(*static_cast<I*>(&i));
797 
798  ++i;
799 
800  return tmp;
801  }
802 
803 
804  //
805  // Comparison operator implementation. The library supplied operators
806  // enables the user to provide fully interoperable constant/mutable
807  // iterator types. I.e. the library provides all operators
808  // for all mutable/constant iterator combinations.
809  //
810  // Note though that this kind of interoperability for constant/mutable
811  // iterators is not required by the standard for container iterators.
812  // All the standard asks for is a conversion mutable -> constant.
813  // Most standard library implementations nowadays provide fully interoperable
814  // iterator implementations, but there are still heavily used implementations
815  // that do not provide them. (Actually it's even worse, they do not provide
816  // them for only a few iterators.)
817  //
818  // ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should
819  // enable the user to turn off mixed type operators
820  //
821  // The library takes care to provide only the right operator overloads.
822  // I.e.
823  //
824  // bool operator==(Iterator, Iterator);
825  // bool operator==(ConstIterator, Iterator);
826  // bool operator==(Iterator, ConstIterator);
827  // bool operator==(ConstIterator, ConstIterator);
828  //
829  // ...
830  //
831  // In order to do so it uses c++ idioms that are not yet widely supported
832  // by current compiler releases. The library is designed to degrade gracefully
833  // in the face of compiler deficiencies. In general compiler
834  // deficiencies result in less strict error checking and more obscure
835  // error messages, functionality is not affected.
836  //
837  // For full operation compiler support for "Substitution Failure Is Not An Error"
838  // (aka. enable_if) and boost::is_convertible is required.
839  //
840  // The following problems occur if support is lacking.
841  //
842  // Pseudo code
843  //
844  // ---------------
845  // AdaptorA<Iterator1> a1;
846  // AdaptorA<Iterator2> a2;
847  //
848  // // This will result in a no such overload error in full operation
849  // // If enable_if or is_convertible is not supported
850  // // The instantiation will fail with an error hopefully indicating that
851  // // there is no operator== for Iterator1, Iterator2
852  // // The same will happen if no enable_if is used to remove
853  // // false overloads from the templated conversion constructor
854  // // of AdaptorA.
855  //
856  // a1 == a2;
857  // ----------------
858  //
859  // AdaptorA<Iterator> a;
860  // AdaptorB<Iterator> b;
861  //
862  // // This will result in a no such overload error in full operation
863  // // If enable_if is not supported the static assert used
864  // // in the operator implementation will fail.
865  // // This will accidently work if is_convertible is not supported.
866  //
867  // a == b;
868  // ----------------
869  //
870 
871 # ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP
872 # define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_()
873 # else
874 # define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible<a,b>()
875 # endif
876 
877 # define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \
878  BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \
879  { \
880  /* For those compilers that do not support enable_if */ \
881  BOOST_STATIC_ASSERT(( \
882  is_interoperable< Derived1, Derived2 >::value \
883  )); \
884  return_prefix iterator_core_access::base_op( \
885  *static_cast<Derived1 const*>(&lhs) \
886  , *static_cast<Derived2 const*>(&rhs) \
887  , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \
888  ); \
889  }
890 
891 # define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \
892  BOOST_ITERATOR_FACADE_INTEROP( \
893  op \
894  , boost::iterators::detail::always_bool2 \
895  , return_prefix \
896  , base_op \
897  )
898 
899  BOOST_ITERATOR_FACADE_RELATION(==, return, equal)
900  BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal)
901 
902 # undef BOOST_ITERATOR_FACADE_RELATION
903 
904 
905 # define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(op, result_type, return_prefix, base_op) \
906  BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \
907  { \
908  /* For those compilers that do not support enable_if */ \
909  BOOST_STATIC_ASSERT(( \
910  is_interoperable< Derived1, Derived2 >::value && \
911  boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \
912  boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \
913  )); \
914  return_prefix iterator_core_access::base_op( \
915  *static_cast<Derived1 const*>(&lhs) \
916  , *static_cast<Derived2 const*>(&rhs) \
917  , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \
918  ); \
919  }
920 
921 # define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \
922  BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \
923  op \
924  , boost::iterators::detail::always_bool2 \
925  , return_prefix \
926  , base_op \
927  )
928 
929  BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from)
930  BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>, return 0 <, distance_from)
931  BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=, return 0 >=, distance_from)
932  BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=, return 0 <=, distance_from)
933 
934 # undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
935 
936  // operator- requires an additional part in the static assertion
938  -
940  , return
941  , distance_from
942  )
943 
944 # undef BOOST_ITERATOR_FACADE_INTEROP
945 # undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS
946 
947 # define BOOST_ITERATOR_FACADE_PLUS(args) \
948  BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \
949  { \
950  Derived tmp(static_cast<Derived const&>(i)); \
951  return tmp += n; \
952  }
953 
956  , typename Derived::difference_type n
957  ))
958 
960  typename Derived::difference_type n
962  ))
963 
964 # undef BOOST_ITERATOR_FACADE_PLUS
965 # undef BOOST_ITERATOR_FACADE_PLUS_HEAD
966 
967 # undef BOOST_ITERATOR_FACADE_INTEROP_HEAD
968 # undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD
969 # undef BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL
970 
971 } // namespace iterators
972 
975 
976 } // namespace boost
977 
979 
980 #endif // BOOST_ITERATOR_FACADE_23022003THW_HPP
boost::iterators::iterator_core_access::equal
static bool equal(Facade1 const &f1, Facade2 const &f2, mpl::true_)
Definition: iterator_facade.hpp:565
iterator_traits.hpp
always.hpp
false_
bool_< false > false_
Definition: bool_fwd.hpp:25
boost::iterators::iterator_difference
Definition: iterator_traits.hpp:39
BOOST_STATIC_CONSTANT
#define BOOST_STATIC_CONSTANT(type, assignment)
Definition: suffix.hpp:394
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::associated_types
boost::iterators::detail::iterator_facade_types< Value, CategoryOrTraversal, Reference, Difference > associated_types
Definition: iterator_facade.hpp:636
boost::iterators::iterator_core_access::BOOST_ITERATOR_FACADE_PLUS_HEAD
BOOST_ITERATOR_FACADE_PLUS_HEAD(friend inline,(iterator_facade< Derived, V, TC, R, D > const &, typename Derived::difference_type))
is_convertible.hpp
boost::iterators::enable_if
Definition: iterator/detail/enable_if.hpp:68
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true >::operator-
Derived operator-(difference_type x) const
Definition: iterator_facade.hpp:752
remove_reference.hpp
iterator_categories.hpp
identity.hpp
boost::iterators::detail::operator_arrow_dispatch::proxy::m_ref
Reference m_ref
Definition: iterator_facade.hpp:330
boost::iterators::iterator_facade::iterator_facade_
iterator_facade< Derived, Value, CategoryOrTraversal, Reference, Difference > iterator_facade_
Definition: iterator_facade.hpp:785
BOOST_ITERATOR_FACADE_RELATION
#define BOOST_ITERATOR_FACADE_RELATION(op)
Definition: iterator_facade.hpp:891
add_pointer.hpp
boost::iterators::detail::use_operator_brackets_proxy
Definition: iterator_facade.hpp:383
T
T
Definition: mem_fn_cc.hpp:25
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true >::base_type
iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > base_type
Definition: iterator_facade.hpp:722
iterator.hpp
config.hpp
boost::iterators::detail::operator_arrow_dispatch< T &, Pointer >::apply
static result_type apply(T &x)
Definition: iterator_facade.hpp:343
boost::iterators::detail::operator_arrow_dispatch::apply
static result_type apply(Reference const &x)
Definition: iterator_facade.hpp:333
boost::iterators::detail::writable_postfix_increment_proxy::operator=
T & operator=(T &x) const
Definition: iterator_facade.hpp:214
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false >::operator--
Derived operator--(int)
Definition: iterator_facade.hpp:702
boost::iterators::detail::iterator_facade_types::iterator_category
facade_iterator_category< CategoryOrTraversal, ValueParam, Reference >::type iterator_category
Definition: iterator_facade.hpp:117
boost::iterators::iterator_core_access::derived
static I & derived(iterator_facade< I, V, TC, R, D > &facade)
Definition: iterator_facade.hpp:600
enable_if.hpp
boost::is_convertible
Definition: is_convertible.hpp:477
boost::iterators::iterator_core_access::derived
static I const & derived(iterator_facade< I, V, TC, R, D > const &facade)
Definition: iterator_facade.hpp:606
static_assert.hpp
add_lvalue_reference.hpp
boost::iterators::detail::enable_if_interoperable
Definition: iterator_facade.hpp:77
addressof.hpp
boost::type
Definition: type.hpp:14
boost::iterators::iterator_core_access
Definition: iterator_facade.hpp:496
boost::iterators::detail::iterator_facade_base
Definition: iterator_facade.hpp:443
boost::iterators::detail::operator_brackets_proxy
Definition: iterator_facade.hpp:353
boost::iterators::detail::operator_brackets_proxy::operator_brackets_proxy
operator_brackets_proxy(Iterator const &iter)
Definition: iterator_facade.hpp:361
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::iterators::detail::operator_brackets_proxy::operator=
operator_brackets_proxy & operator=(value_type const &val)
Definition: iterator_facade.hpp:370
boost::addressof
BOOST_FORCEINLINE T * addressof(T &v)
Definition: core/addressof.hpp:108
boost::iterators::detail::always_bool2
Definition: iterator_facade.hpp:54
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::pointer
operator_arrow_dispatch_::result_type pointer
Definition: iterator_facade.hpp:648
interoperable.hpp
is_pod.hpp
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true >::difference_type
base_type::difference_type difference_type
Definition: iterator_facade.hpp:726
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true >::operator[]
boost::iterators::detail::operator_brackets_result< Derived, Value, reference >::type operator[](difference_type n) const
Definition: iterator_facade.hpp:730
boost::iterators::detail::operator_arrow_dispatch< T &, Pointer >::result_type
Pointer result_type
Definition: iterator_facade.hpp:342
BOOST_ITERATOR_FACADE_PLUS
#define BOOST_ITERATOR_FACADE_PLUS(args)
boost::iterators::detail::iterator_facade_types::pointer
mpl::eval_if< boost::iterators::detail::iterator_writability_disabled< ValueParam, Reference >, add_pointer< const value_type >, add_pointer< value_type > >::type pointer
Definition: iterator_facade.hpp:126
boost::iterators::detail::operator_arrow_dispatch::proxy::proxy
proxy(Reference const &x)
Definition: iterator_facade.hpp:325
boost::iterators::detail::operator_brackets_result::type
mpl::if_< use_operator_brackets_proxy< Value, Reference >, operator_brackets_proxy< Iterator >, Value >::type type
Definition: iterator_facade.hpp:401
boost::iterators::detail::iterator_facade_types
Definition: iterator_facade.hpp:113
boost::iterators::detail::operator_arrow_dispatch
Definition: iterator_facade.hpp:321
config_def.hpp
boost::iterators::detail::make_operator_brackets_result
operator_brackets_proxy< Iterator > make_operator_brackets_result(Iterator const &iter, mpl::true_)
Definition: iterator_facade.hpp:405
boost::iterators::BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(-, boost::iterators::detail::choose_difference_type, return, distance_from) BOOST_ITERATOR_FACADE_PLUS((iterator_facade< Derived
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::difference_type
Difference difference_type
Definition: iterator_facade.hpp:646
boost::iterators::detail::writable_postfix_increment_proxy::operator=
T const & operator=(T const &x) const
Definition: iterator_facade.hpp:206
f
f
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::iterator_category
associated_types::iterator_category iterator_category
Definition: iterator_facade.hpp:650
boost::iterators::detail::postfix_increment_proxy::value_type
iterator_value< Iterator >::type value_type
Definition: iterator_facade.hpp:155
and.hpp
boost::iterators::detail::operator_brackets_proxy::m_iter
Iterator m_iter
Definition: iterator_facade.hpp:377
boost::iterators::operator++
boost::iterators::detail::postfix_increment_result< I, V, R, TC >::type operator++(iterator_facade< I, V, TC, R, D > &i, int)
Definition: iterator_facade.hpp:790
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::operator_arrow_dispatch_
boost::iterators::detail::operator_arrow_dispatch< Reference, typename associated_types::pointer > operator_arrow_dispatch_
Definition: iterator_facade.hpp:641
boost::iterators::detail::iterator_facade_types::value_type
remove_const< ValueParam >::type value_type
Definition: iterator_facade.hpp:119
boost::iterators::detail::writable_postfix_increment_proxy::stored_value
value_type stored_value
Definition: iterator_facade.hpp:227
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::operator->
pointer operator->() const
Definition: iterator_facade.hpp:658
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false >
Definition: iterator_facade.hpp:692
boost::iterators::iterator_core_access::dereference
static Facade::reference dereference(Facade const &f)
Definition: iterator_facade.hpp:547
boost::iterators::iterator_core_access::BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD
BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend, -, boost::iterators::detail::choose_difference_type)
boost::iterators::detail::enable_if_interoperable_and_random_access_traversal
Definition: iterator_facade.hpp:92
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true >::operator-=
Derived & operator-=(difference_type n)
Definition: iterator_facade.hpp:746
boost::iterators::detail::is_traversal_at_least
Definition: iterator_facade.hpp:65
remove_const.hpp
boost::iterators::detail::writable_postfix_increment_proxy::value_type
iterator_value< Iterator >::type value_type
Definition: iterator_facade.hpp:181
apply.hpp
boost::iterators::detail::operator_brackets_proxy::reference
Iterator::reference reference
Definition: iterator_facade.hpp:357
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::derived
Derived const & derived() const
Definition: iterator_facade.hpp:678
add_const.hpp
boost::iterators::detail::facade_iterator_category
Definition: facade_iterator_category.hpp:180
boost::iterators::iterator_core_access::distance_from
static Facade2::difference_type distance_from(Facade1 const &f1, Facade2 const &f2, mpl::false_)
Definition: iterator_facade.hpp:590
is_same.hpp
BOOST_DELETED_FUNCTION
#define BOOST_DELETED_FUNCTION(fun)
Definition: suffix.hpp:702
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false >::operator--
Derived & operator--()
Definition: iterator_facade.hpp:696
config_undef.hpp
boost::iterators::iterator_core_access::increment
static void increment(Facade &f)
Definition: iterator_facade.hpp:553
boost::iterators::detail::writable_postfix_increment_proxy::writable_postfix_increment_proxy
writable_postfix_increment_proxy(Iterator const &x)
Definition: iterator_facade.hpp:183
eval_if.hpp
boost::iterators::detail::postfix_increment_proxy::stored_value
value_type stored_value
Definition: iterator_facade.hpp:171
boost::mpl::eval_if
Definition: gcc/basic_bind.hpp:408
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::derived
Derived & derived()
Definition: iterator_facade.hpp:673
boost::remove_const::type
T type
Definition: remove_const.hpp:21
boost::iterators::detail::always_bool2::apply
Definition: iterator_facade.hpp:57
boost::iterators::detail::choose_difference_type
Definition: iterator_facade.hpp:416
boost::iterators::detail::iterator_writability_disabled
Definition: facade_iterator_category.hpp:62
boost::iterators::i
D const & i
Definition: iterator_facade.hpp:956
boost::iterators::detail::postfix_increment_proxy::operator*
value_type & operator*() const
Definition: iterator_facade.hpp:166
boost::iterators::iterator_core_access::equal
static bool equal(Facade1 const &f1, Facade2 const &f2, mpl::false_)
Definition: iterator_facade.hpp:571
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::value_type
associated_types::value_type value_type
Definition: iterator_facade.hpp:644
boost::iterators::R
R
Definition: iterator_facade.hpp:955
boost::mpl::if_
Definition: dmc/basic_bind.hpp:374
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true >::reference
base_type::reference reference
Definition: iterator_facade.hpp:725
boost::iterators::detail::operator_brackets_result
Definition: iterator_facade.hpp:395
true_
bool_< true > true_
Definition: bool_fwd.hpp:21
boost::iterators::detail::writable_postfix_increment_proxy::stored_iterator
Iterator stored_iterator
Definition: iterator_facade.hpp:228
boost::iterators::iterator_facade
Definition: iterator_facade.hpp:47
boost::iterators::detail::postfix_increment_proxy::postfix_increment_proxy
postfix_increment_proxy(Iterator const &x)
Definition: iterator_facade.hpp:157
facade_iterator_category.hpp
BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION
#define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op)
Definition: iterator_facade.hpp:921
boost::iterators::iterator_core_access::distance_from
static Facade1::difference_type distance_from(Facade1 const &f1, Facade2 const &f2, mpl::true_)
Definition: iterator_facade.hpp:583
boost::iterators::detail::postfix_increment_result
Definition: iterator_facade.hpp:284
boost::iterators::detail::postfix_increment_proxy
Definition: iterator_facade.hpp:153
boost::iterators::detail::always_bool2::apply::type
bool type
Definition: iterator_facade.hpp:59
boost::iterators::detail::operator_arrow_dispatch::proxy
Definition: iterator_facade.hpp:323
boost::iterators::iterator_core_access::advance
static void advance(Facade &f, typename Facade::difference_type n)
Definition: iterator_facade.hpp:577
boost::add_pointer
Definition: add_pointer.hpp:51
boost::mpl::not_
Definition: not.hpp:39
not.hpp
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::operator*
reference operator*() const
Definition: iterator_facade.hpp:653
boost::iterators::detail::operator_arrow_dispatch::proxy::operator->
Reference * operator->()
Definition: iterator_facade.hpp:326
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::operator++
Derived & operator++()
Definition: iterator_facade.hpp:663
boost::iterators::iterator_core_access::decrement
static void decrement(Facade &f)
Definition: iterator_facade.hpp:559
boost::iterators::detail::operator_brackets_proxy::value_type
Iterator::value_type value_type
Definition: iterator_facade.hpp:358
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false >::reference
Reference reference
Definition: iterator_facade.hpp:645
boost::iterators::detail::is_non_proxy_reference
Definition: iterator_facade.hpp:259
if.hpp
boost::iterators::iterator_value::type
boost::detail::iterator_traits< Iterator >::value_type type
Definition: iterator_traits.hpp:22
or.hpp
boost::iterators::detail::writable_postfix_increment_proxy::operator*
writable_postfix_increment_proxy const & operator*() const
Definition: iterator_facade.hpp:193
boost::iterators::detail::choose_difference_type::apply
Definition: iterator_facade.hpp:419
boost::iterators::detail::writable_postfix_increment_proxy
Definition: iterator_facade.hpp:179
boost::iterators::detail::iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true >::operator+=
Derived & operator+=(difference_type n)
Definition: iterator_facade.hpp:740
boost::iterators::detail::operator_arrow_dispatch::result_type
proxy result_type
Definition: iterator_facade.hpp:332


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