BloombergLP::bslstl::RandomAccessIterator

STL-compliant random-access iterator adapted from a minimal implementation.

Synopsis

Declared in <bslstl_randomaccessiterator.h>

template<
    class T,
    class ITER_IMP,
    class TAG_TYPE = std::random_access_iterator_tag>
class RandomAccessIterator
    : public BidirectionalIterator<T, ITER_IMP, TAG_TYPE>

Description

Given an ITER_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 "random-access iterator" in the C++ standard. If T is const-qualified, then the resulting type is a const iterator. T shall not be a function, reference type or void. ITER_IMP must provide public operations so that, for objects i and j of type ITER_IMP and n of an integral type, the following operations are supported: ` ITER_IMP i; default construction ITER_IMP j(i); copy construction i = j assignment ++i increment to next element --i decrement to previous element i += n increment by n elements i -= n decrement by n elements j - i // convertible to ptrdiff_t distance from i to j i == j // convertible to bool equality comparison i < j // convertible to bool less-than comparison *i // reference convertible to T& element access (dereference) `

Base Classes

NameDescription
BidirectionalIterator<T, ITER_IMP, TAG_TYPE>Adaptor that produces a standard bidirectional iterator from a core type.

Type Aliases

NameDescription
difference_type Signed integer type measuring iterator distance.
iterator_category Random-access iterator category tag.
pointer Pointer type for the iterator's value type.
reference Reference type for the iterator's value type.
value_type Value type referred to by this iterator.

Member Functions

NameDescription
RandomAccessIterator [constructor]Constructors
operator= Assignment operators
imp imp overloads
operator* Return a reference to the current element.
operator++ Advance this iterator to the next element.
operator+= Advance this iterator by the specified offset.
operator-- Regress this iterator to the previous element.
operator-= Regress this iterator by the specified offset.
operator-> Return a pointer to the current element.
operator[] Return a reference to the element at the specified index offset.

Non-Member Functions

NameDescription
operator!=Return true if lhs and rhs do not have the same value.
operator!=Return true if lhs and rhs do not have the same value.
operator!=Return whether two bidirectional iterators refer to different positions.
operator+Return an iterator rhs positions past lhs.
operator+Return an iterator lhs positions past rhs.
operator++Advance iter to the next element and return its previous value.
operator++Advance iter to the next element and return its previous value.
operator++Post-increment the specified iterator and return its previous value.
operator-Return an iterator rhs positions before lhs.
operator-Return the distance from rhs to lhs.
operator--Regress iter to the previous element and return its previous value.
operator--Post-decrement the specified iterator and return its previous value.
operator<Return true if lhs precedes rhs in the iteration sequence.
operator<=Return true if lhs precedes or equals rhs in the iteration sequence.
operator==Return true if lhs and rhs have the same value.
operator==Return whether two bidirectional iterators refer to the same position.
operator==Return true if lhs and rhs have the same value.
operator>Return true if lhs follows rhs in the iteration sequence.
operator>=Return true if lhs follows or equals rhs in the iteration sequence.