Simbody
3.6
|
Helper class to use range-based for loops with a pair of iterators. More...
Public Member Functions | |
IteratorRange (Iterator first, Iterator last) | |
This constructor allows you to iterate over the range [first, last) ; this means last won't be reached. More... | |
IteratorRange (const std::pair< Iterator, Iterator > &range) | |
Iterator | begin () const |
Iterator | end () const |
Related Functions | |
(Note that these are not member functions.) | |
template<class Iterator > | |
IteratorRange< Iterator > | makeIteratorRange (Iterator first, Iterator last) |
Make an IteratorRange object to be used in a range-based for loop, using two iterators. More... | |
template<class Iterator > | |
IteratorRange< Iterator > | makeIteratorRange (const std::pair< Iterator, Iterator > &range) |
Make an IteratorRange object to be used in a range-based for loop, using an std::pair of iterators. More... | |
Helper class to use range-based for loops with a pair of iterators.
This class should only be used when you're sure the iterators are valid. Don't use this class directly; instead, use makeIteratorRange().
Here's an example of using iterators first
and last
to iterate over the range [first, last)
(that is, last
won't be reached):
You can also use this class with an std::pair of iterators, such as that returned by std::multimap::equal_range(). We assume the first iterator in the pair is the first iterator in the range, and the second iterator in the pair is the last iterator in the range.
|
inline |
This constructor allows you to iterate over the range [first, last)
; this means last
won't be reached.
|
inlineexplicit |
|
inline |
|
inline |
|
related |
Make an IteratorRange object to be used in a range-based for loop, using two iterators.
|
related |
Make an IteratorRange object to be used in a range-based for loop, using an std::pair of iterators.