[#BloombergLP-bdlc-CompactedArray_ConstIterator]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::CompactedArray&lowbar;ConstIterator
:relfileprefix: ../../
:mrdocs:

This value&hyphen;semantic class represents a random access iterator providing non&hyphen;modifiable access to the elements of a `CompactedArray`&period; 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&lowbar;iterator`&period;

== Synopsis

Declared in `&lt;bdlc&lowbar;compactedarray&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
class CompactedArray&lowbar;ConstIterator;
----

== Description

This class does not perform any bounds checking&period; Any iterator, `it`, referencing a `CompactedArray` `array`, remains valid while `0 &lt;&equals; it &hyphen; array&period;begin() &lt; array&period;length()`&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/difference_type.adoc[`difference&lowbar;type`] 
| Signed type used for distances between iterators&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/iterator_category.adoc[`iterator&lowbar;category`] 
| Tag identifying this type as a random&hyphen;access iterator&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/pointer.adoc[`pointer`] 
| Pointer into the array (unused&semi; always `TYPE &ast;`)&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/reference.adoc[`reference`] 
| Reference to an element (unused&semi; always `TYPE&amp;`)&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/size_type.adoc[`size&lowbar;type`] 
| Unsigned type used for lengths and indices&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/value_type.adoc[`value&lowbar;type`] 
| Element type of the referenced array&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/2constructor-08.adoc[`CompactedArray&lowbar;ConstIterator`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_assign.adoc[`operator&equals;`] 
| Assign to this iterator the value of the specified `rhs` iterator, and return a reference providing modifiable access to this iterator&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_star.adoc[`operator&ast;`] 
| Return a `const` reference to the element referenced by this iterator&period; The behavior is undefined unless for this iterator, referencing a `CompactedArray` `array`, `CompactedArray&lowbar;ConstIterator() !&equals; &ast;this` and `&ast;this &hyphen; array&period;begin() &lt; array&period;length()`&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_inc.adoc[`operator&plus;&plus;`] 
| Advance this iterator to refer to the next location in the referenced array, and return a reference to this iterator _after_ the advancement&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless, on entry, `CompactedArray&lowbar;ConstIterator() !&equals; &ast;this` and `&ast;this &hyphen; array&period;begin() &lt; array&period;length()`&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_plus_eq.adoc[`operator&plus;&equals;`] 
| Advance this iterator by the specified `offset` from the location referenced by this iterator, and return a reference providing modifiable access to this iterator&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless `CompactedArray&lowbar;ConstIterator() !&equals; &ast;this` and `0 &lt;&equals; &ast;this &hyphen; array&period;begin() &plus; offset &lt;&equals; array&period;length()`&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_dec.adoc[`operator&hyphen;&hyphen;`] 
| Decrement this iterator to refer to the previous location in the referenced array, and return a reference to this iterator _after_ the decrementation&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless, on entry, `CompactedArray&lowbar;ConstIterator() !&equals; &ast;this` and `0 &lt; &ast;this &hyphen; array&period;begin()`&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_minus_eq.adoc[`operator&hyphen;&equals;`] 
| Decrement this iterator by the specified `offset` from the location referenced by this iterator, and return a reference providing modifiable access to this iterator&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless `CompactedArray&lowbar;ConstIterator() !&equals; &ast;this` and `0 &lt;&equals; &ast;this &hyphen; array&period;begin() &hyphen; offset &lt;&equals; array&period;length()`&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_ptr.adoc[`operator&hyphen;&gt;`] 
| Return a `const` reference to the element referenced by this iterator&period; The behavior is undefined unless for this iterator, referencing a `CompactedArray` `array`, `CompactedArray&lowbar;ConstIterator() !&equals; &ast;this` and `&ast;this &hyphen; array&period;begin() &lt; array&period;length()`&period;
| xref:BloombergLP/bdlc/CompactedArray_ConstIterator/operator_subs.adoc[`operator&lsqb;&rsqb;`] 
| Return a `const` reference to the element at the specified `offset` from the location referenced by this iterator&period; The behavior is undefined unless for this iterator, referencing a `CompactedArray` `array`, `CompactedArray&lowbar;ConstIterator() !&equals; &ast;this` and `0 &lt;&equals; &ast;this &hyphen; array&period;begin() &plus; offset &lt; array&period;length()`&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlc/operator_ge-06.adoc[BloombergLP::bdlc::operator&gt;&equals;]`
| Return whether the left iterator follows or equals the right (see free `operator&gt;&equals;`)&period;
| `xref:BloombergLP/bdlc/operator_gt-05.adoc[BloombergLP::bdlc::operator&gt;]`
| Return whether the left iterator follows the right (see free `operator&gt;`)&period;
| `xref:BloombergLP/bdlc/operator_le-04.adoc[BloombergLP::bdlc::operator&lt;&equals;]`
| Return whether the left iterator precedes or equals the right (see free `operator&lt;&equals;`)&period;
| `xref:BloombergLP/bdlc/operator_lt-03.adoc[BloombergLP::bdlc::operator&lt;]`
| Return whether the left iterator precedes the right (see free `operator&lt;`)&period;
| `xref:BloombergLP/bdlc/operator_minus-0af.adoc[BloombergLP::bdlc::operator&hyphen;]`
| Return the signed distance between two iterators (see free `operator&hyphen;`)&period;
| `xref:BloombergLP/bdlc/operator_minus-01.adoc[BloombergLP::bdlc::operator&hyphen;]`
| Return an iterator at the negated specified offset from the given iterator (see free `operator&hyphen;`)&period;
| `xref:BloombergLP/bdlc/operator_plus-0c.adoc[BloombergLP::bdlc::operator&plus;&lt;&gt;]`
| Return an iterator at the specified offset from the given iterator (see free `operator&plus;`)&period;
| `xref:BloombergLP/bdlc/operator_not_eq-01b.adoc[BloombergLP::bdlc::operator!&equals;]`
| Return whether the iterators refer to different positions (see free `operator!&equals;`)&period;
| `xref:BloombergLP/bdlc/operator_eq-091.adoc[BloombergLP::bdlc::operator&equals;&equals;]`
| Return whether the iterators refer to the same position (see free `operator&equals;&equals;`)&period;
| `xref:BloombergLP/bdlc/operator_dec-0d4.adoc[BloombergLP::bdlc::operator&hyphen;&hyphen;]`
| Decrement `iterator` and return its prior value (see free `operator&hyphen;&hyphen;`)&period;
| `xref:BloombergLP/bdlc/operator_inc-0b.adoc[BloombergLP::bdlc::operator&plus;&plus;]`
| Advance `iterator` and return its prior value (see free `operator&plus;&plus;`)&period;
| `xref:BloombergLP/bdlc/CompactedArray.adoc[BloombergLP::bdlc::CompactedArray]`
| This space&hyphen;efficient, value&hyphen;semantic array class represents a sequence of `TYPE` elements&period; The interface provides functionality similar to a `vector&lt;TYPE&gt;`, however, modifiable references to individual elements are not provided&period; This class provides accessors that return iterators that provide non&hyphen;modifiable access to its elements&period; The returned iterators, unlike those returned by a `vector&lt;TYPE&gt;`, are _not_ invalidated upon reallocation&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlc/operator_not_eq-047d.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` and `rhs` iterators do not have the same value, and `false` otherwise&period; Two `CompactedArray&lowbar;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&period;
| xref:BloombergLP/bdlc/operator_plus-03.adoc[`operator&plus;`]
| Same as the preceding overload with operands swapped&period;
| xref:BloombergLP/bdlc/operator_plus-07.adoc[`operator&plus;`]
| Return an iterator referencing the location at the specified `offset` from the location referenced by the specified `iterator`&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless `CompactedArray&lowbar;ConstIterator() !&equals; iterator` and `0 &lt;&equals; iterator &hyphen; array&period;begin() &plus; offset &lt;&equals; array&period;length()`&period;
| xref:BloombergLP/bdlc/operator_inc-07.adoc[`operator&plus;&plus;`]
| 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)&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless, on entry, `CompactedArray&lowbar;ConstIterator() !&equals; iterator` and `iterator &hyphen; array&period;begin() &lt; array&period;length()`&period;
| xref:BloombergLP/bdlc/operator_minus-03.adoc[`operator&hyphen;`]
| Return an iterator referencing the location at the specified `offset` from the location referenced by the specified `iterator`&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless `CompactedArray&lowbar;ConstIterator() !&equals; iterator` and `0 &lt;&equals; iterator &hyphen; array&period;begin() &hyphen; offset &lt;&equals; array&period;length()`&period;
| xref:BloombergLP/bdlc/operator_minus-08.adoc[`operator&hyphen;`]
| Return the number of elements between the specified `lhs` and `rhs` as a signed value&period; The behavior is undefined unless `lhs` and `rhs` reference the same array&period; Note that the return value is positive when a positive number of `rhs&plus;&plus;` invocations would result in `lhs &equals;&equals; rhs`, and negative when a positive number of `rhs&hyphen;&hyphen;` invocations would result in `lhs &equals;&equals; rhs`&period;
| xref:BloombergLP/bdlc/operator_dec-0dd.adoc[`operator&hyphen;&hyphen;`]
| 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)&period; The returned iterator, `it`, referencing a `CompactedArray` `array`, remains valid as long as `0 &lt;&equals; it &hyphen; array&period;begin() &lt;&equals; array&period;length()`&period; The behavior is undefined unless, on entry, `CompactedArray&lowbar;ConstIterator() !&equals; iterator` and `0 &lt; iterator &hyphen; array&period;begin()`&period;
| xref:BloombergLP/bdlc/operator_lt-0a6.adoc[`operator&lt;`]
| Return `true` if the specified `lhs` has a value less than the specified `rhs`, and `false` otherwise&period; Iterator `lhs` has a value less than iterator `rhs` if `0 &lt; rhs &hyphen; lhs` (see `operator&hyphen;`)&period; The behavior is undefined unless `lhs` and `rhs` refer to the same array&period;
| xref:BloombergLP/bdlc/operator_le-0b.adoc[`operator&lt;&equals;`]
| Return `true` if the specified `lhs` has a value less than or equal to the specified `rhs, and `false&apos; otherwise&period; Iterator `lhs` has a value less than or equal to iterator `rhs` if `0 &lt;&equals; rhs &hyphen; lhs` (see `operator&hyphen;`)&period; The behavior is undefined unless `lhs` and `rhs` refer to the same array&period;
| xref:BloombergLP/bdlc/operator_eq-0e8.adoc[`operator&equals;&equals;`]
| Return `true` if the specified `lhs` and `rhs` iterators have the same value, and `false` otherwise&period; Two `CompactedArray&lowbar;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&period;
| xref:BloombergLP/bdlc/operator_gt-04.adoc[`operator&gt;`]
| Return `true` if the specified `lhs` has a value greater than the specified `rhs`, and `false` otherwise&period; Iterator `lhs` has a value greater than iterator `rhs` if `0 &gt; rhs &hyphen; lhs` (see `operator&hyphen;`)&period; The behavior is undefined unless `lhs` and `rhs` refer to the same array&period;
| xref:BloombergLP/bdlc/operator_ge-0c.adoc[`operator&gt;&equals;`]
| Return `true` if the specified `lhs` has a value greater or equal than the specified `rhs`, and `false` otherwise&period; Iterator `lhs` has a value greater than or equal to iterator `rhs` if `0 &gt;&equals; rhs &hyphen; lhs` (see `operator&hyphen;`)&period; The behavior is undefined unless `lhs` and `rhs` refer to the same array&period;
|===


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