cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : Miscellaneous : iterator : RandomAccessIterator
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
functional
iterator
memory
utility
iterator
advance
back_inserter
distance
front_inserter
inserter
iterator
iterator_traits
iterator categories:
· BidirectionalIterator
· ForwardIterator
· InputIterator
· OutputIterator
· RandomAccessIterator
predefined iterators:
· back_insert_iterator
· front_insert_iterator
· insert_iterator
· istreambuf_iterator
· istream_iterator
· ostreambuf_iterator
· ostream_iterator
· reverse_iterator

-

RandomAccessIterator
<iterator>

Random-access iterator category

RandomAccess

Bidirectional iterators are iterators especially designed for having the same functionality as standard pointers. Pointers are random access iterators.

Random access iterators are the most complete iterators in terms of functionality. They have the following characteristics:


characteristicvalid expressions
Can be default-constructedX a;
X()
Can be copied and copy-constructedX b(a);
b = a;
Accepts equality/inequality comparisons.
Equal iterators imply the same element is pointed
a == b
a != b
Can be dereferenced (when not null)*a
a->m
Can be incremented and decremented (when not null)++a
--a
a++
a--
Supports arithmetic operators + and - between an iterator and an integer valuea + n
n + a
Supports inequality comparisons (< and >) between iteratorsa < b
a > b
Supports compound assinment operations +=, -=, <= and >=a += n
a -= n
a <= b
a >= b
Supports offset dereference operator ([])a[n]
Where X is an iterator type, a and b are objects of this iterator type, and n is an integral type.

See also

InputIterator Input iterator category
OutputIterator Output iterator category
ForwardIterator Forward iterator category
BidirectionalIterator Bidirectional iterator category
iterator Iterator definitions (header)

Home page | Privacy policy
© cplusplus.com, 2000-2008 - All rights reserved - v2.2
Spotted an error? contact us