1 // Copyright David Abrahams 2004. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 #ifndef NODE_ITERATOR3_DWA2004110_HPP
5 # define NODE_ITERATOR3_DWA2004110_HPP
8 # include <boost/iterator/iterator_adaptor.hpp>
10 # ifndef BOOST_NO_SFINAE
11 # include <boost/type_traits/is_convertible.hpp>
12 # include <boost/utility/enable_if.hpp>
15 template <class Value>
17 : public boost::iterator_adaptor<
18 node_iter<Value> // Derived
20 , boost::use_default // Value
21 , boost::forward_traversal_tag // CategoryOrTraversal
25 struct enabler {}; // a private type avoids misuse
27 typedef boost::iterator_adaptor<
28 node_iter<Value>, Value*, boost::use_default, boost::forward_traversal_tag
35 explicit node_iter(Value* p)
38 template <class OtherValue>
40 node_iter<OtherValue> const& other
41 # ifndef BOOST_NO_SFINAE
42 , typename boost::enable_if<
43 boost::is_convertible<OtherValue*,Value*>
48 : super_t(other.base()) {}
50 # if !BOOST_WORKAROUND(__GNUC__, == 2)
51 private: // GCC2 can't grant friendship to template member functions
52 friend class boost::iterator_core_access;
54 void increment() { this->base_reference() = this->base()->next(); }
57 typedef node_iter<node_base> node_iterator;
58 typedef node_iter<node_base const> node_const_iterator;
60 #endif // NODE_ITERATOR3_DWA2004110_HPP