cpp/iterator/reverse iterator

is an iterator adaptor that reverses the direction of a given iterator, which must be at least a. In other words, when provided with a bidirectional iterator, produces a new iterator that moves from the end to the beginning of the sequence defined by the underlying bidirectional iterator.

For a reverse iterator constructed from an iterator, the relationship  is always  (as long as  is ); thus a reverse iterator constructed from a one-past-the-end iterator dereferences to the last element in a sequence.

This is the iterator returned by member functions and  of the standard library containers.

Helper templates
This partial specialization of prevents specializations of  from satisfying  if their underlying iterators do not satisfy the concept.

Possible implementation
Below is a partial implementation focusing on the way the inner iterator is stored, calling std only when the content is fetched via.