[#BloombergLP-bdlc-CompactedArray_ConstIterator] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::CompactedArray_ConstIterator :relfileprefix: ../../ :mrdocs: This value‐semantic class represents a random access iterator providing non‐modifiable access to the elements of a `CompactedArray`. 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_compactedarray.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class CompactedArray_ConstIterator; ---- == Description This class does not perform any bounds checking. Any iterator, `it`, referencing a `CompactedArray` `array`, remains valid while `0 <= it ‐ array.begin() < array.length()`. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/difference_type.adoc[`difference_type`] | Signed type used for distances between iterators. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/iterator_category.adoc[`iterator_category`] | Tag identifying this type as a random‐access iterator. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/pointer.adoc[`pointer`] | Pointer into the array (unused; always `TYPE *`). | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/reference.adoc[`reference`] | Reference to an element (unused; always `TYPE&`). | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/size_type.adoc[`size_type`] | Unsigned type used for lengths and indices. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/value_type.adoc[`value_type`] | Element type of the referenced array. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/2constructor-08.adoc[`CompactedArray_ConstIterator`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_assign.adoc[`operator=`] | Assign to this iterator the value of the specified `rhs` iterator, and return a reference providing modifiable access to this iterator. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_star.adoc[`operator*`] | Return a `const` reference to the element referenced by this iterator. The behavior is undefined unless for this iterator, referencing a `CompactedArray` `array`, `CompactedArray_ConstIterator() != *this` and `*this ‐ array.begin() < array.length()`. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_inc.adoc[`operator++`] | Advance this iterator to refer to the next location in the referenced array, and return a reference to this iterator _after_ the advancement. The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless, on entry, `CompactedArray_ConstIterator() != *this` and `*this ‐ array.begin() < array.length()`. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_plus_eq.adoc[`operator+=`] | Advance this iterator by the specified `offset` from the location referenced by this iterator, and return a reference providing modifiable access to this iterator. The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless `CompactedArray_ConstIterator() != *this` and `0 <= *this ‐ array.begin() + offset <= array.length()`. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_dec.adoc[`operator‐‐`] | Decrement this iterator to refer to the previous location in the referenced array, and return a reference to this iterator _after_ the decrementation. The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless, on entry, `CompactedArray_ConstIterator() != *this` and `0 < *this ‐ array.begin()`. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_minus_eq.adoc[`operator‐=`] | Decrement this iterator by the specified `offset` from the location referenced by this iterator, and return a reference providing modifiable access to this iterator. The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless `CompactedArray_ConstIterator() != *this` and `0 <= *this ‐ array.begin() ‐ offset <= array.length()`. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_ptr.adoc[`operator‐>`] | Return a `const` reference to the element referenced by this iterator. The behavior is undefined unless for this iterator, referencing a `CompactedArray` `array`, `CompactedArray_ConstIterator() != *this` and `*this ‐ array.begin() < array.length()`. | xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_subs.adoc[`operator[]`] | Return a `const` reference to the element at the specified `offset` from the location referenced by this iterator. The behavior is undefined unless for this iterator, referencing a `CompactedArray` `array`, `CompactedArray_ConstIterator() != *this` and `0 <= *this ‐ array.begin() + offset < array.length()`. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlc/operator_ge-06.adoc[BloombergLP::bdlc::operator>=]` | Return whether the left iterator follows or equals the right (see free `operator>=`). | `xref:BloombergLP/bdlc/operator_gt-05.adoc[BloombergLP::bdlc::operator>]` | Return whether the left iterator follows the right (see free `operator>`). | `xref:BloombergLP/bdlc/operator_le-04.adoc[BloombergLP::bdlc::operator<=]` | Return whether the left iterator precedes or equals the right (see free `operator<=`). | `xref:BloombergLP/bdlc/operator_lt-03.adoc[BloombergLP::bdlc::operator<]` | Return whether the left iterator precedes the right (see free `operator<`). | `xref:BloombergLP/bdlc/operator_minus-0af.adoc[BloombergLP::bdlc::operator‐]` | Return the signed distance between two iterators (see free `operator‐`). | `xref:BloombergLP/bdlc/operator_minus-01.adoc[BloombergLP::bdlc::operator‐]` | Return an iterator at the negated specified offset from the given iterator (see free `operator‐`). | `xref:BloombergLP/bdlc/operator_plus-0c.adoc[BloombergLP::bdlc::operator+<>]` | Return an iterator at the specified offset from the given iterator (see free `operator+`). | `xref:BloombergLP/bdlc/operator_not_eq-01b.adoc[BloombergLP::bdlc::operator!=]` | Return whether the iterators refer to different positions (see free `operator!=`). | `xref:BloombergLP/bdlc/operator_eq-091.adoc[BloombergLP::bdlc::operator==]` | Return whether the iterators refer to the same position (see free `operator==`). | `xref:BloombergLP/bdlc/operator_dec-0d4.adoc[BloombergLP::bdlc::operator‐‐]` | Decrement `iterator` and return its prior value (see free `operator‐‐`). | `xref:BloombergLP/bdlc/operator_inc-0b.adoc[BloombergLP::bdlc::operator++]` | Advance `iterator` and return its prior value (see free `operator++`). | `xref:BloombergLP/bdlc/CompactedArray.adoc[BloombergLP::bdlc::CompactedArray]` | This space‐efficient, value‐semantic array class represents a sequence of `TYPE` elements. The interface provides functionality similar to a `vector<TYPE>`, however, modifiable 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<TYPE>`, are _not_ invalidated upon reallocation. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/operator_not_eq-047d.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` iterators do not have the same value, and `false` otherwise. Two `CompactedArray_ConstIterator` iterators do not have the same value if one has the default value and the other does not, or neither has the default value and they do not reference the same location in the same array. | xref:BloombergLP/bdlc/operator_plus-03.adoc[`operator+`] | Same as the preceding overload with operands swapped. | xref:BloombergLP/bdlc/operator_plus-07.adoc[`operator+`] | Return an iterator referencing the location at the specified `offset` from the location referenced by the specified `iterator`. The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless `CompactedArray_ConstIterator() != iterator` and `0 <= iterator ‐ array.begin() + offset <= array.length()`. | xref:BloombergLP/bdlc/operator_inc-07.adoc[`operator++`] | Advance the specified `iterator` to refer to the next location in the referenced array, and return an iterator referring to the original location (_before_ the advancement). The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless, on entry, `CompactedArray_ConstIterator() != iterator` and `iterator ‐ array.begin() < array.length()`. | xref:BloombergLP/bdlc/operator_minus-03.adoc[`operator‐`] | Return an iterator referencing the location at the specified `offset` from the location referenced by the specified `iterator`. The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless `CompactedArray_ConstIterator() != iterator` and `0 <= iterator ‐ array.begin() ‐ offset <= array.length()`. | xref:BloombergLP/bdlc/operator_minus-08.adoc[`operator‐`] | Return the number of elements between the specified `lhs` and `rhs` as a signed value. The behavior is undefined unless `lhs` and `rhs` reference the same array. Note that the return value is positive when a positive number of `rhs++` invocations would result in `lhs == rhs`, and negative when a positive number of `rhs‐‐` invocations would result in `lhs == rhs`. | xref:BloombergLP/bdlc/operator_dec-0dd.adoc[`operator‐‐`] | Decrement the specified `iterator` to refer to the previous location in the referenced array, and return an iterator referring to the original location (_before_ the decrementation). The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 <= it ‐ array.begin() <= array.length()`. The behavior is undefined unless, on entry, `CompactedArray_ConstIterator() != iterator` and `0 < iterator ‐ array.begin()`. | xref:BloombergLP/bdlc/operator_lt-0a6.adoc[`operator<`] | Return `true` if the specified `lhs` has a value less than the specified `rhs`, and `false` otherwise. Iterator `lhs` has a value less than iterator `rhs` if `0 < rhs ‐ lhs` (see `operator‐`). The behavior is undefined unless `lhs` and `rhs` refer to the same array. | xref:BloombergLP/bdlc/operator_le-0b.adoc[`operator<=`] | Return `true` if the specified `lhs` has a value less than or equal to the specified `rhs, and `false' otherwise. Iterator `lhs` has a value less than or equal to iterator `rhs` if `0 <= rhs ‐ lhs` (see `operator‐`). The behavior is undefined unless `lhs` and `rhs` refer to the same array. | xref:BloombergLP/bdlc/operator_eq-0e8.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` iterators have the same value, and `false` otherwise. Two `CompactedArray_ConstIterator` iterators have the same value if they both have the default value, or neither has the default value and they reference the same location in the same array. | xref:BloombergLP/bdlc/operator_gt-04.adoc[`operator>`] | Return `true` if the specified `lhs` has a value greater than the specified `rhs`, and `false` otherwise. Iterator `lhs` has a value greater than iterator `rhs` if `0 > rhs ‐ lhs` (see `operator‐`). The behavior is undefined unless `lhs` and `rhs` refer to the same array. | xref:BloombergLP/bdlc/operator_ge-0c.adoc[`operator>=`] | Return `true` if the specified `lhs` has a value greater or equal than the specified `rhs`, and `false` otherwise. Iterator `lhs` has a value greater than or equal to iterator `rhs` if `0 >= rhs ‐ lhs` (see `operator‐`). The behavior is undefined unless `lhs` and `rhs` refer to the same array. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#