Reputation: 6846
Does anyone know of a source that gives an overview of the requirements regarding iterator_category
posed by various algorithms in the C++ standard library? The documentation I've seen only gives the required iterator_category
for each specific algorithm, not an overview of all algorithms.
Specifically, I am looking for cases where a bidirectional_iterator
is needed where a forward_iterator
wouldn't do.
Upvotes: 0
Views: 122
Reputation: 137310
Searching for "Bidirectional" in Clause 25 gives:
std::copy_backward
std::move_backward
std::reverse
std::reverse_copy
std::stable_partition
std::inplace_merge
std::next_permutation
std::prev_permutation
In general, you can consult the <algorithm>
synopsis in §25.1 [algorithms.general] of the standard.
Upvotes: 3
Reputation: 6578
The standard lays out the requirements for the various iterators, with the relevant section being §24.2 [iterator.requirements].
As to your question specifically with regard to bidirectional iterators, they are required whenever it is necessary to move an iterator backwards, since they support every operation supported by forward iterators, in addition to:
--i
i--
*i--
Upvotes: 0