annotate DEPENDENCIES/generic/include/boost/graph/detail/incremental_components.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 //=======================================================================
Chris@16 2 // Copyright 2002 Indiana University.
Chris@16 3 // Copyright 2009 Trustees of Indiana University.
Chris@16 4 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek, Michael Hansen
Chris@16 5 //
Chris@16 6 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 7 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 8 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //=======================================================================
Chris@16 10
Chris@16 11 #ifndef BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP
Chris@16 12 #define BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP
Chris@16 13
Chris@16 14 #include <boost/operators.hpp>
Chris@16 15
Chris@16 16 namespace boost {
Chris@16 17
Chris@16 18 namespace detail {
Chris@16 19
Chris@16 20 // Iterator for a component index linked list. The contents of
Chris@16 21 // each array element represent the next index in the list. A
Chris@16 22 // special value (the maximum index + 1) is used to terminate a
Chris@16 23 // list.
Chris@16 24 template <typename IndexRandomAccessIterator>
Chris@16 25 class component_index_iterator :
Chris@16 26 boost::forward_iterator_helper<component_index_iterator<IndexRandomAccessIterator>,
Chris@16 27 typename std::iterator_traits<IndexRandomAccessIterator>::value_type,
Chris@16 28 typename std::iterator_traits<IndexRandomAccessIterator>::difference_type,
Chris@16 29 typename std::iterator_traits<IndexRandomAccessIterator>::pointer,
Chris@16 30 typename std::iterator_traits<IndexRandomAccessIterator>::reference> {
Chris@16 31
Chris@16 32 private:
Chris@16 33 typedef component_index_iterator<IndexRandomAccessIterator> self;
Chris@16 34
Chris@16 35 public:
Chris@16 36 typedef std::forward_iterator_tag iterator_category;
Chris@16 37 typedef typename std::iterator_traits<IndexRandomAccessIterator>::value_type value_type;
Chris@16 38 typedef typename std::iterator_traits<IndexRandomAccessIterator>::difference_type reference;
Chris@16 39 typedef typename std::iterator_traits<IndexRandomAccessIterator>::pointer pointer;
Chris@16 40 typedef typename std::iterator_traits<IndexRandomAccessIterator>::reference difference_type;
Chris@16 41
Chris@16 42 // Constructor for "begin" iterator
Chris@16 43 component_index_iterator(IndexRandomAccessIterator index_iterator,
Chris@16 44 value_type begin_index) :
Chris@16 45 m_index_iterator(index_iterator),
Chris@16 46 m_current_index(begin_index) { }
Chris@16 47
Chris@16 48 // Constructor for "end" iterator (end_index should be the linked
Chris@16 49 // list terminator).
Chris@16 50 component_index_iterator(value_type end_index) :
Chris@16 51 m_current_index(end_index) { }
Chris@16 52
Chris@16 53 inline value_type operator*() const {
Chris@16 54 return (m_current_index);
Chris@16 55 }
Chris@16 56
Chris@16 57 self& operator++() {
Chris@16 58 // Move to the next element in the linked list
Chris@16 59 m_current_index = m_index_iterator[m_current_index];
Chris@16 60 return (*this);
Chris@16 61 }
Chris@16 62
Chris@16 63 bool operator==(const self& other_iterator) const {
Chris@16 64 return (m_current_index == *other_iterator);
Chris@16 65 }
Chris@16 66
Chris@16 67 protected:
Chris@16 68 IndexRandomAccessIterator m_index_iterator;
Chris@16 69 value_type m_current_index;
Chris@16 70
Chris@16 71 }; // class component_index_iterator
Chris@16 72
Chris@16 73 } // namespace detail
Chris@16 74
Chris@16 75 } // namespace detail
Chris@16 76
Chris@16 77 #endif // BOOST_GRAPH_DETAIL_INCREMENTAL_COMPONENTS_HPP