Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <iterators.h>
Public Types | |
using | const_iterator = Iterator |
using | value_type = typename std::iterator_traits<Iterator>::value_type |
Public Member Functions | |
BeginEndWrapper (Iterator begin, Iterator end) | |
Iterator | begin () const |
Iterator | end () const |
size_t | size () const |
bool | empty () const |
This is useful for wrapping iterators of a class that support many different iterations. For instance, on a Graph class, one can write:
BeginEndWrapper<OutgoingArcIterator> Graph::OutgoingArcs(NodeInde node) const { return BeginEndWrapper( OutgoingArcIterator(this, node, /*at_end=/false), OutgoingArcIterator(this, node, /*at_end=/true)); }
And a client will use it like this:
for (const ArcIndex arc : graph.OutgoingArcs(node)) { ... }
Definition at line 38 of file iterators.h.
using util::BeginEndWrapper< Iterator >::const_iterator = Iterator |
Definition at line 40 of file iterators.h.
using util::BeginEndWrapper< Iterator >::value_type = typename std::iterator_traits<Iterator>::value_type |
Definition at line 41 of file iterators.h.
|
inline |
Definition at line 43 of file iterators.h.
|
inline |
Definition at line 44 of file iterators.h.
|
inline |
Definition at line 48 of file iterators.h.
|
inline |
Definition at line 45 of file iterators.h.
|
inline |
Definition at line 46 of file iterators.h.