![]() |
Google OR-Tools v9.14
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 ()=default | |
If Iterator is default-constructible, an empty range. | |
BeginEndWrapper (Iterator begin, Iterator end) | |
Iterator | begin () const |
Iterator | end () const |
size_t | size () const |
Available only if Iterator is a random access iterator. | |
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 48 of file iterators.h.
using util::BeginEndWrapper< Iterator >::const_iterator = Iterator |
Definition at line 50 of file iterators.h.
using util::BeginEndWrapper< Iterator >::value_type = typename std::iterator_traits<Iterator>::value_type |
Definition at line 51 of file iterators.h.
|
default |
If Iterator is default-constructible, an empty range.
|
inline |
Definition at line 56 of file iterators.h.
|
inline |
Definition at line 58 of file iterators.h.
|
inline |
Definition at line 64 of file iterators.h.
|
inline |
Definition at line 59 of file iterators.h.
|
inline |
Available only if Iterator is a random access iterator.
Definition at line 62 of file iterators.h.