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_INDIRECT_ITERATOR_23022003THW_HPP
8 #define BOOST_INDIRECT_ITERATOR_23022003THW_HPP
10 #include <boost/iterator.hpp>
11 #include <boost/iterator/iterator_adaptor.hpp>
13 #include <boost/pointee.hpp>
14 #include <boost/indirect_reference.hpp>
15 #include <boost/detail/iterator.hpp>
17 #include <boost/detail/indirect_traits.hpp>
19 #include <boost/type_traits/is_same.hpp>
20 #include <boost/type_traits/add_reference.hpp>
22 #include <boost/mpl/bool.hpp>
23 #include <boost/mpl/identity.hpp>
24 #include <boost/mpl/eval_if.hpp>
25 #include <boost/mpl/not.hpp>
26 #include <boost/mpl/has_xxx.hpp>
28 #ifdef BOOST_MPL_CFG_NO_HAS_XXX
29 # include <boost/shared_ptr.hpp>
30 # include <boost/scoped_ptr.hpp>
31 # include <boost/mpl/bool.hpp>
35 #include <boost/iterator/detail/config_def.hpp> // must be last #include
39 template <class Iter
, class Value
, class Category
, class Reference
, class Difference
>
40 class indirect_iterator
;
44 template <class Iter
, class Value
, class Category
, class Reference
, class Difference
>
47 typedef typename iterator_traits
<Iter
>::value_type dereferenceable
;
49 typedef iterator_adaptor
<
50 indirect_iterator
<Iter
, Value
, Category
, Reference
, Difference
>
52 , typename ia_dflt_help
<
53 Value
, pointee
<dereferenceable
>
56 , typename ia_dflt_help
<
59 is_same
<Value
,use_default
>
60 , indirect_reference
<dereferenceable
>
61 , add_reference
<Value
>
69 struct indirect_base
<int, int, int, int, int> {};
75 , class Value
= use_default
76 , class Category
= use_default
77 , class Reference
= use_default
78 , class Difference
= use_default
80 class indirect_iterator
81 : public detail::indirect_base
<
82 Iterator
, Value
, Category
, Reference
, Difference
85 typedef typename
detail::indirect_base
<
86 Iterator
, Value
, Category
, Reference
, Difference
89 friend class iterator_core_access
;
92 indirect_iterator() {}
94 indirect_iterator(Iterator iter
)
98 class Iterator2
, class Value2
, class Category2
99 , class Reference2
, class Difference2
103 Iterator2
, Value2
, Category2
, Reference2
, Difference2
105 , typename enable_if_convertible
<Iterator2
, Iterator
>::type
* = 0
111 typename
super_t::reference
dereference() const
113 # if BOOST_WORKAROUND(__BORLANDC__, < 0x5A0 )
114 return const_cast<super_t::reference
>(**this->base());
116 return **this->base();
121 template <class Iter
>
123 indirect_iterator
<Iter
> make_indirect_iterator(Iter x
)
125 return indirect_iterator
<Iter
>(x
);
128 template <class Traits
, class Iter
>
130 indirect_iterator
<Iter
,Traits
> make_indirect_iterator(Iter x
, Traits
* = 0)
132 return indirect_iterator
<Iter
, Traits
>(x
);
137 #include <boost/iterator/detail/config_undef.hpp>
139 #endif // BOOST_INDIRECT_ITERATOR_23022003THW_HPP