Iterator Concepts

From Cppreference

Jump to: navigation, search

Contents

[edit] Notation

In the following, as in the standard, the following notation is used:

[edit] Iterator Requirements

Iterator is a general concept that does not guarantee much beyond the ability to advance and dereference elements. Formally, an iterator has the following requirements:

In addition, the following expressions are valid:

Examples:

[edit] InputIterator Requirements

A class X satisfies the requirements of an InputIterator for the value type T if X satisfies the Iterator and EqualityComparable requirements and the following expressions are valid:

{
  T tmp = *a;
  ++a;
  return a;
}

[edit] OutputIterator Requirements

A class X satisfies the requirements of an OutputIterator if X satisfies the Iterator requirements.

[edit] ForwardIterator Requirements

[edit] BidirectionalIterator Requirements

[edit] RandomAccessIterator Requirements