BloombergLP::bdlc::PackedIntArrayConstIterator

This unconstrained (value-semantic) class represents a random access iterator providing non-modifiable access to the elements of a PackedIntArray. This class provides all functionality of a random access iterator, as defined by the standard, but is not compatible with most standard methods requiring a bidirectional const_iterator.

Synopsis

Declared in <bdlc_packedintarray.h>

template<class TYPE>
class PackedIntArrayConstIterator;

Description

This class does not perform any bounds checking. The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid while 0 <= it - array.begin() < array.length().

Type Aliases

NameDescription
difference_type Iterator difference type.
pointer Iterator pointer type.
reference Iterator reference type.
size_type Iterator size type.
value_type Iterator value type.

Member Functions

NameDescription
PackedIntArrayConstIterator [constructor]Constructors
operator= Assign to this iterator the value of the specified rhs iterator, and return a reference providing modifiable access to this iterator.
operator* Return the element value referenced by this iterator. The behavior is undefined unless for this iterator, referencing an element within a PackedIntArray array, PackedIntArrayConstInterator() != *this and *this - array.begin() < array.length().
operator+ Return an iterator referencing the location at the specified offset from the element referenced by this iterator. The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless 0 <= *this - array.begin() + offset <= array.length().
operator++ Advance this iterator to refer to the next element in the referenced array and return a reference to this iterator after the advancement. The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless, on entry, PackedIntArrayConstInterator() != *this and *this - array.begin() < array.length().
operator+= Advance this iterator by the specified offset from the element referenced to this iterator. The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless PackedIntArrayConstInterator() != *this and 0 <= *this - array.begin() + offset <= array.length().
operator- Return an iterator referencing the location at the specified offset from the element referenced by this iterator. The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless PackedIntArrayConstInterator() != *this and 0 <= *this - array.begin() - offset <= array.length().
operator-- Decrement this iterator to refer to the previous element in the referenced array and return a reference to this iterator after the decrementation. The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless, on entry, 0 < *this - array.begin().
operator-= Decrement this iterator by the specified offset from the element referenced to this iterator. The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless PackedIntArrayConstInterator() != *this and 0 <= *this - array.begin() - offset <= array.length().
operator-> Return the element value referenced by this iterator. The behavior is undefined unless for this iterator, referencing an element within a PackedIntArray array, PackedIntArrayConstInterator() != *this and *this - array.begin() < array.length().
operator[] Return the element that is the specified offset from the element reference by this array. The behavior is undefined unless for this iterator, referencing an element within a PackedIntArray array, PackedIntArrayConstInterator() != *this and 0 <= *this - array.begin() + offset < array.length().

Friends

NameDescription
BloombergLP::bdlc::operator>=<>
BloombergLP::bdlc::operator><>
BloombergLP::bdlc::operator<=<>
BloombergLP::bdlc::operator<<>
BloombergLP::bdlc::operator-<>
BloombergLP::bdlc::operator!=<>
BloombergLP::bdlc::operator==<>
BloombergLP::bdlc::operator--<>
BloombergLP::bdlc::operator++<>
BloombergLP::bdlc::PackedIntArrayThis space-efficient value-semantic array class represents a sequence of TYPE elements; TYPE must be convertible to either a signed or unsigned 64-bit integer using static_cast. The interface provides functionality similar to a vector<int> however references to individual elements are not provided. This class provides accessors that return iterators that provide non-modifiable access to its elements. The returned iterators, unlike those returned by a vector<int> are not invalidated upon reallocation.

Non-Member Functions

NameDescription
operator!=Return true if the specified lhs and rhs iterators do not have the same value and false otherwise. Two PackedIntArrayConstIterator iterators do not have the same value if they do not refer to the same array, or do not have the same index.
operator++Advance the specified iterator iter to refer to the next element in the referenced array, and return an iterator referring to the original element (before the advancement). The returned iterator, it, referencing an element within a PackedIntArray, array, remains valid as long as 0 <= it - array.begin() <= array.length(). The behavior is undefined unless, on entry, PackedIntArrayConstInterator() != iter and iter - array.begin() < array.length().
operator-Return the number of elements between specified lhs and rhs. The behavior is undefined unless lhs and rhs reference the same array.
operator--Post-decrement the specified iterator iter.
operator<Return true if lhs precedes rhs in the referenced array.
operator<=Return true if the specified lhs has a value less than or equal to the specified rhs, false' otherwise. An iterator has a value less than or equal to another if its index is less or equal the other's index. The behavior is undefined unless lhs and rhs refer to the same array.
operator==Return true if the specified lhs and rhs iterators have the same value, and false otherwise. Two PackedIntArrayConstIterator iterators have the same value if they refer to the same array, and have the same index.
operator>Return true if lhs follows rhs in the referenced array.
operator>=Return true if the specified lhs has a value greater or equal than the specified rhs, false otherwise. An iterator has a value greater than or equal to another if its index is greater the other's index. The behavior is undefined unless lhs and rhs refer to the same array.