1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #ifndef BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP
- #define BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP
- #include <boost/operators.hpp>
- namespace boost
- {
- namespace detail
- {
-
-
-
-
- template < typename IndexRandomAccessIterator >
- class component_index_iterator
- : boost::forward_iterator_helper<
- component_index_iterator< IndexRandomAccessIterator >,
- typename std::iterator_traits<
- IndexRandomAccessIterator >::value_type,
- typename std::iterator_traits<
- IndexRandomAccessIterator >::difference_type,
- typename std::iterator_traits< IndexRandomAccessIterator >::pointer,
- typename std::iterator_traits<
- IndexRandomAccessIterator >::reference >
- {
- private:
- typedef component_index_iterator< IndexRandomAccessIterator > self;
- public:
- typedef std::forward_iterator_tag iterator_category;
- typedef typename std::iterator_traits<
- IndexRandomAccessIterator >::value_type value_type;
- typedef typename std::iterator_traits<
- IndexRandomAccessIterator >::difference_type reference;
- typedef
- typename std::iterator_traits< IndexRandomAccessIterator >::pointer
- pointer;
- typedef typename std::iterator_traits<
- IndexRandomAccessIterator >::reference difference_type;
-
- component_index_iterator(
- IndexRandomAccessIterator index_iterator, value_type begin_index)
- : m_index_iterator(index_iterator), m_current_index(begin_index)
- {
- }
-
-
- component_index_iterator(value_type end_index)
- : m_current_index(end_index)
- {
- }
- inline value_type operator*() const { return (m_current_index); }
- self& operator++()
- {
-
- m_current_index = m_index_iterator[m_current_index];
- return (*this);
- }
- bool operator==(const self& other_iterator) const
- {
- return (m_current_index == *other_iterator);
- }
- protected:
- IndexRandomAccessIterator m_index_iterator;
- value_type m_current_index;
- };
- }
- }
- #endif
|