ROSE  0.11.96.11
Public Member Functions | List of all members
Sawyer::Container::Interval< T >::ConstIterator Class Reference

Description

template<class T>
class Sawyer::Container::Interval< T >::ConstIterator

Bidirectional forward iterator.

This iterator can be incremented, decremented, or dereferenced unless it is already at the end, as determined by its atEnd predicate or by comparison with any other iterator whose atEnd is true, including a default-constructed iterator. An iterator is considered to be at its end if it has been incremented past the interval's greatest value or decremented past the interval's least value. Iterators will operate safely even when the least or greatest value of the range is the least or greatest possible value that can be represented in type T and incrementing or decrementing would cause an overflow. This is acheived by pretending that there's an extra value one less than the interval's least value and one greater than the intervals greatest value, regardless of whether such values exist for type T. Incrementing an iterator that's positioned one past the interval's greatest is a no-op, as is decrementing an iterator positioned one prior to the interval's least end. On the other hand, decrementing an iterator positioned one past the interval's greatest end positions the iterator at greatest and clears its atEnd property; similarly, incrementing an iterator positioned one prior to the interval's least end positions the iterator at the least value.

Definition at line 63 of file Interval.h.

#include <Interval.h>

Inheritance diagram for Sawyer::Container::Interval< T >::ConstIterator:
Inheritance graph
[legend]
Collaboration diagram for Sawyer::Container::Interval< T >::ConstIterator:
Collaboration graph
[legend]

Public Member Functions

 ConstIterator ()
 Create an empty iterator. More...
 
bool atEnd () const
 Predicate to determine if an iterator is at one of its end positions. More...
 

Constructor & Destructor Documentation

◆ ConstIterator()

template<class T >
Sawyer::Container::Interval< T >::ConstIterator::ConstIterator ( )
inline

Create an empty iterator.

All increment and decrement operators are no-ops and atEnd always returns true. It is illegal to attempt to dereference such an iterator. A default-constructed iterator compares equal to all other default-constructed iterators and equal to all iterators positioned at one of their ends.

Definition at line 78 of file Interval.h.

Member Function Documentation

◆ atEnd()

template<class T >
bool Sawyer::Container::Interval< T >::ConstIterator::atEnd ( ) const
inline

Predicate to determine if an iterator is at one of its end positions.

Returns true if this iterator is positioned one prior to the interval's least end, or one after the interval's greatest end. These two positions are virtual and exist even if type T is unable to represent them. Since intervals are immutable, their iterators' end-points are defined when the iterator is created and are constant.

Definition at line 85 of file Interval.h.


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