1 // Boost.Geometry Index
5 // Copyright (c) 2011-2015 Adam Wulkiewicz, Lodz, Poland.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ITERATORS_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ITERATORS_HPP
14 namespace boost { namespace geometry { namespace index { namespace detail { namespace rtree { namespace iterators {
16 template <typename Value, typename Allocators>
19 typedef std::forward_iterator_tag iterator_category;
20 typedef Value value_type;
21 typedef typename Allocators::const_reference reference;
22 typedef typename Allocators::difference_type difference_type;
23 typedef typename Allocators::const_pointer pointer;
25 reference operator*() const
27 BOOST_GEOMETRY_INDEX_ASSERT(false, "iterator not dereferencable");
32 const value_type * operator->() const
34 BOOST_GEOMETRY_INDEX_ASSERT(false, "iterator not dereferencable");
35 const value_type * p = 0;
39 end_iterator & operator++()
41 BOOST_GEOMETRY_INDEX_ASSERT(false, "iterator not incrementable");
45 end_iterator operator++(int)
47 BOOST_GEOMETRY_INDEX_ASSERT(false, "iterator not incrementable");
51 friend bool operator==(end_iterator const& /*l*/, end_iterator const& /*r*/)
57 template <typename Value, typename Options, typename Translator, typename Box, typename Allocators>
60 typedef visitors::iterator<Value, Options, Translator, Box, Allocators> visitor_type;
61 typedef typename visitor_type::node_pointer node_pointer;
64 typedef std::forward_iterator_tag iterator_category;
65 typedef Value value_type;
66 typedef typename Allocators::const_reference reference;
67 typedef typename Allocators::difference_type difference_type;
68 typedef typename Allocators::const_pointer pointer;
73 inline iterator(node_pointer root)
75 m_visitor.initialize(root);
78 reference operator*() const
80 return m_visitor.dereference();
83 const value_type * operator->() const
85 return boost::addressof(m_visitor.dereference());
88 iterator & operator++()
90 m_visitor.increment();
94 iterator operator++(int)
96 iterator temp = *this;
101 friend bool operator==(iterator const& l, iterator const& r)
103 return l.m_visitor == r.m_visitor;
106 friend bool operator==(iterator const& l, end_iterator<Value, Allocators> const& /*r*/)
108 return l.m_visitor.is_end();
111 friend bool operator==(end_iterator<Value, Allocators> const& /*l*/, iterator const& r)
113 return r.m_visitor.is_end();
117 visitor_type m_visitor;
120 }}}}}} // namespace boost::geometry::index::detail::rtree::iterators
122 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_ITERATORS_HPP