...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A Trivial Iterator i
is a type that represents a reference to an element of some Sequence, and allows to access the element through its nested type
member [1]. A trivial iterator does not define any traversal operations.
type
member is a well-defined operation.
Expression | Expression type |
---|---|
typename i::type | A type |
Expression | Complexity | Precondition | Semantics | Postcondition |
---|---|---|---|---|
typename i::type | Amortized constant time | i is dereferenceable | i::type is identical to the type of the pointed element |
For any trivial iterators i
and j
the following invariants always hold:
i
and j
are identical if and only if they are pointing to the same element;
i
is dereferenceable, and j
is identical to i
, then j
is dereferenceable as well;
i
and j
are identical and dereferenceable, then i::type
and j::type
are identical.