...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A Forward Iterator traverses a Sequence allowing movement in only one direction through it's elements, one element at a time.
Notation
i
, j
Forward Iterators
I
, J
Forward Iterator types
M
An MPL integral constant
N
An integral constant
A type models Forward Iterator if, in addition to being CopyConstructable, the following expressions are valid:
Expression |
Return type |
Runtime Complexity |
---|---|---|
|
Constant |
|
|
Convertible to bool |
Constant |
|
Convertible to bool |
Constant |
|
Constant |
|
|
Constant |
|
|
|
Constant |
|
|
Constant |
|
|
Constant |
Expression |
Compile Time Complexity |
---|---|
|
Amortized constant time |
|
Amortized constant time |
|
Linear |
|
Linear |
|
Linear |
|
Amortized constant time |
|
Amortized constant time |
[ table [[Expression] [Semantics]] [[
] [An
iterator to the element following next
(i)i
]]
[[i ==
j
] [Iterator equality comparison]]
[[i !=
j
] [Iterator inequality comparison]]
[[
] [An
iterator n elements after advance_c
<N>(i)i
in the sequence]] [[
] [Equivalent
to advance
<M>(i)advance_c<M::value>(i)
]] [[
] [The number of elements between distance
(i, j)i
and j
]]
[[
]
[The element at positionderef
(i)i
]]
[[*i
]
[Equivalent to deref(i)
]]
]
The following invariants always hold:
std::pair
iterator
boost::array
iterator
vector
iterator
cons
iterator
list
iterator
set
iterator
map
iterator
single_view
iterator
filter_view
iterator
iterator_range
iterator
joint_view
iterator
transform_view
iterator
reverse_view
iterator