Search code examples
c++iterator

Overview over the iterator requirements of various algorithms


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.


Solution

  • 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.