Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

reverse_iterator

Library:  Iterators


Does not inherit

Local Index

No Entries

Summary

An iterator adaptor that traverses a collection backwards.

Synopsis

#include <iterator>

namespace std {
  template <class Iterator>
  class reverse_iterator;
}

Description

The class template reverse_iterator adapts any random access iterator or bidirectional_iterator to facilitate the traversal of collections in the opposite direction. The fundamental relationship between a reverse iterator and its corresponding iterator i is established by the identity:

This mapping is necessary because, while an iterator past the end of a sequence is still valid but not dereferenceable, there might not be a valid iterator before its beginning.

Interface

Example

Complexity

All iterator operations are required to take at most amortized constant time.

See Also

Iterators

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 24.4.1.1



Previous fileTop of DocumentContentsIndex pageNext file