16#ifndef UTIL_GRAPH_ITERATORS_H_
17#define UTIL_GRAPH_ITERATORS_H_
37template <
typename Iterator>
41 using value_type =
typename std::iterator_traits<Iterator>::value_type;
44 Iterator
begin()
const {
return begin_; }
45 Iterator
end()
const {
return end_; }
46 size_t size()
const {
return end_ - begin_; }
51 const Iterator begin_;
58template <
typename Iterator>
62template <
typename Iterator>
64 std::pair<Iterator, Iterator> begin_end) {
71template <
typename MultiMap>
73 MultiMap& multi_map,
const typename MultiMap::key_type& key) {
76template <
typename MultiMap>
78 const MultiMap& multi_map,
const typename MultiMap::key_type& key) {
86template <
typename Container>
90 typename Container::const_reverse_iterator
begin()
const {
93 typename Container::const_reverse_iterator
end()
const {
return c_.rend(); }
98template <
typename Container>
104template <
typename IntegerType>
106 :
public std::iterator<std::input_iterator_tag, IntegerType> {
110 : index_(other.index_) {}
112 index_ = other.index_;
117 return index_ < other.index_;
120 return index_ == other.index_;
130 return previous_position;
146template <
typename IntegerType>
160 explicit Iterator(
typename std::vector<T>::iterator it) : it_(it) {}
169 typename std::vector<T>::iterator it_;
175 std::vector<T>*
const v_;
BeginEndReverseIteratorWrapper(const Container &c)
Container::const_reverse_iterator end() const
Container::const_reverse_iterator begin() const
BeginEndWrapper(Iterator begin, Iterator end)
typename std::iterator_traits< Iterator >::value_type value_type
Simple iterator on an integer range, see IntegerRange below.
IntegerRangeIterator & operator=(const IntegerRangeIterator &other)
bool operator==(const IntegerRangeIterator &other) const
IntegerRangeIterator & operator++()
bool operator!=(const IntegerRangeIterator &other) const
IntegerRangeIterator(const IntegerRangeIterator &other)
IntegerRangeIterator(IntegerType value)
IntegerType operator*() const
IntegerRangeIterator operator++(int)
IntegerRange(IntegerType begin, IntegerType end)
A collections of i/o utilities for the Graph classes in ./graph.h.
BeginEndReverseIteratorWrapper< Container > Reverse(const Container &c)
BeginEndWrapper< Iterator > BeginEndRange(Iterator begin, Iterator end)
BeginEndWrapper< typename MultiMap::iterator > EqualRange(MultiMap &multi_map, const typename MultiMap::key_type &key)
std::optional< int64_t > end
Iterator(typename std::vector< T >::iterator it)
bool operator!=(const Iterator &other) const
Allow iterating over a vector<T> as a mutable vector<T*>.
MutableVectorIteration(std::vector< T > *v)