Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
util::BeginEndWrapper< Iterator > Class Template Reference

#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
 

Detailed Description

template<typename Iterator>
class util::BeginEndWrapper< Iterator >

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.

Member Typedef Documentation

◆ const_iterator

template<typename Iterator >
using util::BeginEndWrapper< Iterator >::const_iterator = Iterator

Definition at line 40 of file iterators.h.

◆ value_type

template<typename Iterator >
using util::BeginEndWrapper< Iterator >::value_type = typename std::iterator_traits<Iterator>::value_type

Definition at line 41 of file iterators.h.

Constructor & Destructor Documentation

◆ BeginEndWrapper()

template<typename Iterator >
util::BeginEndWrapper< Iterator >::BeginEndWrapper ( Iterator begin,
Iterator end )
inline

Definition at line 43 of file iterators.h.

Member Function Documentation

◆ begin()

template<typename Iterator >
Iterator util::BeginEndWrapper< Iterator >::begin ( ) const
inline

Definition at line 44 of file iterators.h.

◆ empty()

template<typename Iterator >
bool util::BeginEndWrapper< Iterator >::empty ( ) const
inline

Definition at line 48 of file iterators.h.

◆ end()

template<typename Iterator >
Iterator util::BeginEndWrapper< Iterator >::end ( ) const
inline

Definition at line 45 of file iterators.h.

◆ size()

template<typename Iterator >
size_t util::BeginEndWrapper< Iterator >::size ( ) const
inline

Definition at line 46 of file iterators.h.


The documentation for this class was generated from the following file: