File indexing completed on 2025-01-18 09:37:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP
0012 #define BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP
0013
0014 #include <boost/operators.hpp>
0015
0016 namespace boost
0017 {
0018
0019 namespace detail
0020 {
0021
0022
0023
0024
0025
0026 template < typename IndexRandomAccessIterator >
0027 class component_index_iterator
0028 : boost::forward_iterator_helper<
0029 component_index_iterator< IndexRandomAccessIterator >,
0030 typename std::iterator_traits<
0031 IndexRandomAccessIterator >::value_type,
0032 typename std::iterator_traits<
0033 IndexRandomAccessIterator >::difference_type,
0034 typename std::iterator_traits< IndexRandomAccessIterator >::pointer,
0035 typename std::iterator_traits<
0036 IndexRandomAccessIterator >::reference >
0037 {
0038
0039 private:
0040 typedef component_index_iterator< IndexRandomAccessIterator > self;
0041
0042 public:
0043 typedef std::forward_iterator_tag iterator_category;
0044 typedef typename std::iterator_traits<
0045 IndexRandomAccessIterator >::value_type value_type;
0046 typedef typename std::iterator_traits<
0047 IndexRandomAccessIterator >::difference_type reference;
0048 typedef
0049 typename std::iterator_traits< IndexRandomAccessIterator >::pointer
0050 pointer;
0051 typedef typename std::iterator_traits<
0052 IndexRandomAccessIterator >::reference difference_type;
0053
0054
0055 component_index_iterator(
0056 IndexRandomAccessIterator index_iterator, value_type begin_index)
0057 : m_index_iterator(index_iterator), m_current_index(begin_index)
0058 {
0059 }
0060
0061
0062
0063 component_index_iterator(value_type end_index)
0064 : m_current_index(end_index)
0065 {
0066 }
0067
0068 inline value_type operator*() const { return (m_current_index); }
0069
0070 self& operator++()
0071 {
0072
0073 m_current_index = m_index_iterator[m_current_index];
0074 return (*this);
0075 }
0076
0077 bool operator==(const self& other_iterator) const
0078 {
0079 return (m_current_index == *other_iterator);
0080 }
0081
0082 protected:
0083 IndexRandomAccessIterator m_index_iterator;
0084 value_type m_current_index;
0085
0086 };
0087
0088 }
0089
0090 }
0091
0092 #endif