1 // (C) Copyright David Abrahams 2002.
2 // (C) Copyright Jeremy Siek 2002.
3 // (C) Copyright Thomas Witt 2002.
4 // Permission to copy, use, modify,
5 // sell and distribute this software is granted provided this
6 // copyright notice appears in all copies. This software is provided
7 // "as is" without express or implied warranty, and with no claim as
8 // to its suitability for any purpose.
9 #ifndef BOOST_INDIRECT_ITERATOR_23022003THW_HPP
10 #define BOOST_INDIRECT_ITERATOR_23022003THW_HPP
12 #include <boost/iterator.hpp>
13 #include <boost/iterator/iterator_adaptor.hpp>
15 #include <boost/pointee.hpp>
16 #include <boost/indirect_reference.hpp>
17 #include <boost/detail/iterator.hpp>
19 #include <boost/python/detail/indirect_traits.hpp>
21 #include <boost/type_traits/is_same.hpp>
22 #include <boost/type_traits/add_reference.hpp>
24 #include <boost/mpl/bool.hpp>
25 #include <boost/mpl/identity.hpp>
26 #include <boost/mpl/apply_if.hpp>
27 #include <boost/mpl/not.hpp>
28 #include <boost/mpl/aux_/has_xxx.hpp>
30 #ifdef BOOST_MPL_NO_AUX_HAS_XXX
31 # include <boost/shared_ptr.hpp>
32 # include <boost/scoped_ptr.hpp>
33 # include <boost/mpl/bool.hpp>
37 #include <boost/iterator/detail/config_def.hpp> // must be last #include
41 template <class Iter, class Value, class Category, class Reference, class Difference>
42 class indirect_iterator;
46 template <class Iter, class Value, class Category, class Reference, class Difference>
49 typedef typename iterator_traits<Iter>::value_type dereferenceable;
51 typedef iterator_adaptor<
52 indirect_iterator<Iter, Value, Category, Reference, Difference>
54 , typename ia_dflt_help<
55 Value, pointee<dereferenceable>
58 , typename ia_dflt_help<
61 is_same<Value,use_default>
62 , indirect_reference<dereferenceable>
63 , add_reference<Value>
71 struct indirect_base<int, int, int, int, int> {};
77 , class Value = use_default
78 , class Category = use_default
79 , class Reference = use_default
80 , class Difference = use_default
82 class indirect_iterator
83 : public detail::indirect_base<
84 Iterator, Value, Category, Reference, Difference
87 typedef typename detail::indirect_base<
88 Iterator, Value, Category, Reference, Difference
91 friend class iterator_core_access;
94 indirect_iterator() {}
96 indirect_iterator(Iterator iter)
100 class Iterator2, class Value2, class Category2
101 , class Reference2, class Difference2
105 Iterator2, Value2, Category2, Reference2, Difference2
107 , typename enable_if_convertible<Iterator2, Iterator>::type* = 0
113 typename super_t::reference dereference() const
115 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
116 return const_cast<super_t::reference>(**this->base());
118 return **this->base();
123 template <class Iter>
125 indirect_iterator<Iter> make_indirect_iterator(Iter x)
127 return indirect_iterator<Iter>(x);
130 template <class Traits, class Iter>
132 indirect_iterator<Iter,Traits> make_indirect_iterator(Iter x, Traits* = 0)
134 return indirect_iterator<Iter, Traits>(x);
139 #include <boost/iterator/detail/config_undef.hpp>
141 #endif // BOOST_INDIRECT_ITERATOR_23022003THW_HPP