[#BloombergLP-bslstl-RandomAccessIterator]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::RandomAccessIterator
:relfileprefix: ../../
:mrdocs:

STL&hyphen;compliant random&hyphen;access iterator adapted from a minimal implementation&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;randomaccessiterator&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class T,
    class ITER&lowbar;IMP,
    class TAG&lowbar;TYPE = std::random&lowbar;access&lowbar;iterator&lowbar;tag&gt;
class RandomAccessIterator
    : public xref:BloombergLP/bslstl/BidirectionalIterator.adoc[BidirectionalIterator&lt;T, ITER&lowbar;IMP, TAG&lowbar;TYPE&gt;]
----

== Description

Given an `ITER&lowbar;IMP` type that implements a minimal subset of an iterator interface, this template generates a complete iterator that meets all of the requirements of a &quot;random&hyphen;access iterator&quot; in the C&plus;&plus; standard&period; If `T` is const&hyphen;qualified, then the resulting type is a const iterator&period; `T` shall not be a function, reference type or void&period; `ITER&lowbar;IMP` must provide public operations so that, for objects `i` and `j` of type `ITER&lowbar;IMP` and `n` of an integral type, the following operations are supported&colon; &grave; ITER&lowbar;IMP i&semi; default construction ITER&lowbar;IMP j(i)&semi; copy construction i &equals; j assignment &plus;&plus;i increment to next element &hyphen;&hyphen;i decrement to previous element i &plus;&equals; n increment by n elements i &hyphen;&equals; n decrement by n elements j &hyphen; i &sol;&sol; convertible to ptrdiff&lowbar;t distance from i to j i &equals;&equals; j &sol;&sol; convertible to bool equality comparison i &lt; j &sol;&sol; convertible to bool less&hyphen;than comparison &ast;i &sol;&sol; reference convertible to T&amp; element access (dereference) &grave;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bslstl/BidirectionalIterator.adoc[BidirectionalIterator&lt;T, ITER&lowbar;IMP, TAG&lowbar;TYPE&gt;]`
| Adaptor that produces a standard bidirectional iterator from a core type&period;
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/RandomAccessIterator/difference_type.adoc[`difference&lowbar;type`] 
| Signed integer type measuring iterator distance&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/iterator_category.adoc[`iterator&lowbar;category`] 
| Random&hyphen;access iterator category tag&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/pointer.adoc[`pointer`] 
| Pointer type for the iterator&apos;s value type&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/reference.adoc[`reference`] 
| Reference type for the iterator&apos;s value type&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/value_type.adoc[`value&lowbar;type`] 
| Value type referred to by this iterator&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/RandomAccessIterator/2constructor-0be.adoc[`RandomAccessIterator`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bslstl/RandomAccessIterator/operator_assign-04.adoc[`operator&equals;`] 
| Assignment operators
| xref:BloombergLP/bslstl/ForwardIterator/imp-0e.adoc[`imp`] 
| `imp` overloads
| xref:BloombergLP/bslstl/ForwardIterator/operator_star.adoc[`operator&ast;`] 
| Return a reference to the current element&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/operator_inc.adoc[`operator&plus;&plus;`] 
| Advance this iterator to the next element&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/operator_plus_eq.adoc[`operator&plus;&equals;`] 
| Advance this iterator by the specified offset&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/operator_dec.adoc[`operator&hyphen;&hyphen;`] 
| Regress this iterator to the previous element&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/operator_minus_eq.adoc[`operator&hyphen;&equals;`] 
| Regress this iterator by the specified offset&period;
| xref:BloombergLP/bslstl/ForwardIterator/operator_ptr.adoc[`operator&hyphen;&gt;`] 
| Return a pointer to the current element&period;
| xref:BloombergLP/bslstl/RandomAccessIterator/operator_subs.adoc[`operator&lsqb;&rsqb;`] 
| Return a reference to the element at the specified index offset&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/operator_not_eq-093.adoc[`operator!&equals;`]
| Return `true` if `lhs` and `rhs` do not have the same value&period;
| xref:BloombergLP/bslstl/operator_not_eq-0bc.adoc[`operator!&equals;`]
| Return `true` if `lhs` and `rhs` do not have the same value&period;
| xref:BloombergLP/bslstl/operator_not_eq-0d.adoc[`operator!&equals;`]
| Return whether two bidirectional iterators refer to different positions&period;
| xref:BloombergLP/bslstl/operator_plus-09.adoc[`operator&plus;`]
| Return an iterator `rhs` positions past `lhs`&period;
| xref:BloombergLP/bslstl/operator_plus-0fa.adoc[`operator&plus;`]
| Return an iterator `lhs` positions past `rhs`&period;
| xref:BloombergLP/bslstl/operator_inc-005.adoc[`operator&plus;&plus;`]
| Advance `iter` to the next element and return its previous value&period;
| xref:BloombergLP/bslstl/operator_inc-008.adoc[`operator&plus;&plus;`]
| Advance `iter` to the next element and return its previous value&period;
| xref:BloombergLP/bslstl/operator_inc-07.adoc[`operator&plus;&plus;`]
| Post&hyphen;increment the specified iterator and return its previous value&period;
| xref:BloombergLP/bslstl/operator_minus-02.adoc[`operator&hyphen;`]
| Return an iterator `rhs` positions before `lhs`&period;
| xref:BloombergLP/bslstl/operator_minus-0b.adoc[`operator&hyphen;`]
| Return the distance from `rhs` to `lhs`&period;
| xref:BloombergLP/bslstl/operator_dec-05.adoc[`operator&hyphen;&hyphen;`]
| Regress `iter` to the previous element and return its previous value&period;
| xref:BloombergLP/bslstl/operator_dec-08.adoc[`operator&hyphen;&hyphen;`]
| Post&hyphen;decrement the specified iterator and return its previous value&period;
| xref:BloombergLP/bslstl/operator_lt.adoc[`operator&lt;`]
| Return `true` if `lhs` precedes `rhs` in the iteration sequence&period;
| xref:BloombergLP/bslstl/operator_le.adoc[`operator&lt;&equals;`]
| Return `true` if `lhs` precedes or equals `rhs` in the iteration sequence&period;
| xref:BloombergLP/bslstl/operator_eq-066.adoc[`operator&equals;&equals;`]
| Return `true` if `lhs` and `rhs` have the same value&period;
| xref:BloombergLP/bslstl/operator_eq-08.adoc[`operator&equals;&equals;`]
| Return whether two bidirectional iterators refer to the same position&period;
| xref:BloombergLP/bslstl/operator_eq-0c7.adoc[`operator&equals;&equals;`]
| Return `true` if `lhs` and `rhs` have the same value&period;
| xref:BloombergLP/bslstl/operator_gt.adoc[`operator&gt;`]
| Return `true` if `lhs` follows `rhs` in the iteration sequence&period;
| xref:BloombergLP/bslstl/operator_ge.adoc[`operator&gt;&equals;`]
| Return `true` if `lhs` follows or equals `rhs` in the iteration sequence&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
