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

Detailed Description

template<typename IntegerType>
class util::IntegerRange< IntegerType >

Allows to easily construct nice functions for range-based for loop. This can be used like this:

for (const int i : IntegerRange<int>(0, 10)) { ... }

But it main purpose is to be used as return value for more complex classes:

for (const ArcIndex arc : graph.AllOutgoingArcs()); for (const NodeIndex node : graph.AllNodes());

Definition at line 235 of file iterators.h.

#include <iterators.h>

Inheritance diagram for util::IntegerRange< IntegerType >:
util::BeginEndWrapper< IntegerRangeIterator< IntegerType > >

Public Member Functions

 IntegerRange (IntegerType begin, IntegerType end)
 Requires begin <= end.
Public Member Functions inherited from util::BeginEndWrapper< IntegerRangeIterator< IntegerType > >
 BeginEndWrapper ()=default
 If Iterator is default-constructible, an empty range.
IntegerRangeIterator< IntegerType > begin () const
IntegerRangeIterator< IntegerType > end () const
size_t size () const
 Available only if Iterator is a random access iterator.
bool empty () const

Additional Inherited Members

Public Types inherited from util::BeginEndWrapper< IntegerRangeIterator< IntegerType > >
using const_iterator
using value_type

Constructor & Destructor Documentation

◆ IntegerRange()

template<typename IntegerType>
util::IntegerRange< IntegerType >::IntegerRange ( IntegerType begin,
IntegerType end )
inline

Requires begin <= end.

Definition at line 238 of file iterators.h.


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