[#BloombergLP-bdlc-PackedIntArray-0b] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlc.adoc[bdlc]::PackedIntArray :relfileprefix: ../../ :mrdocs: This 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. == Synopsis Declared in `<bdlc_packedintarray.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class PackedIntArray; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/PackedIntArray-0b/const_iterator.adoc[`const_iterator`] | Constant iterator type for this packed array. | xref:BloombergLP/bdlc/PackedIntArray-0b/value_type.adoc[`value_type`] | Element value type for this packed array. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/PackedIntArray-0b/2constructor-02.adoc[`PackedIntArray`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlc/PackedIntArray-0b/2destructor.adoc[`~PackedIntArray`] [.small]#[destructor]# | Destroy this object | xref:BloombergLP/bdlc/PackedIntArray-0b/operator_assign.adoc[`operator=`] | Assign to this array the value of the specified `rhs` array, and return a reference providing modifiable access to this array. | xref:BloombergLP/bdlc/PackedIntArray-0b/allocator.adoc[`allocator`] | Return the allocator used by this array to supply memory. | xref:BloombergLP/bdlc/PackedIntArray-0b/append-0c.adoc[`append`] | `append` overloads | xref:BloombergLP/bdlc/PackedIntArray-0b/back.adoc[`back`] | Return the value of the element at the back of this array. The behavior is undefined unless `0 < length()`. Note that this function is logically equivalent to: ` operator ‐ 1) ` | xref:BloombergLP/bdlc/PackedIntArray-0b/bdexStreamIn.adoc[`bdexStreamIn`] | Assign to this object the value read from the specified input `stream` using the specified `version` format, and return a reference to `stream`. If `stream` is initially invalid, this operation has no effect. If `version` is not supported, this object is unaltered and `stream` is invalidated but otherwise unmodified. If `version` is supported but `stream` becomes invalid during this operation, this object has an undefined, but valid, state. Note that no version is read from `stream`. See the `bslx` package‐level documentation for more information on BDEX streaming of value‐semantic types and containers. | xref:BloombergLP/bdlc/PackedIntArray-0b/bdexStreamOut.adoc[`bdexStreamOut`] | Write this value to the specified output `stream` using the specified `version` format, and return a reference to `stream`. If `stream` is initially invalid, this operation has no effect. If `version` is not supported, `stream` is invalidated but otherwise unmodified. Note that `version` is not written to `stream`. See the `bslx` package‐level documentation for more information on BDEX streaming of value‐semantic types and containers. | xref:BloombergLP/bdlc/PackedIntArray-0b/begin.adoc[`begin`] | Return an iterator referring to the first element in this array (or the past‐the‐end iterator if this array is empty). This reference remains valid as long as this array exists. | xref:BloombergLP/bdlc/PackedIntArray-0b/bytesPerElement.adoc[`bytesPerElement`] | Return the number of bytes currently used to store each element in this array. | xref:BloombergLP/bdlc/PackedIntArray-0b/capacity.adoc[`capacity`] | Return the number of elements this array can hold in terms of the current data type used to store its elements. | xref:BloombergLP/bdlc/PackedIntArray-0b/end.adoc[`end`] | Return an iterator referring to one element beyond the last element in this array. This reference remains valid as long as this array exists, and length does not decrease. | xref:BloombergLP/bdlc/PackedIntArray-0b/front.adoc[`front`] | Return the value of the element at the front of this array. The behavior is undefined unless `0 < length()`. Note that this function is logically equivalent to: ` operator ` | xref:BloombergLP/bdlc/PackedIntArray-0b/insert-0ae.adoc[`insert`] | `insert` overloads | xref:BloombergLP/bdlc/PackedIntArray-0b/isEmpty.adoc[`isEmpty`] | Return `true` if there are no elements in this array, and `false` otherwise. | xref:BloombergLP/bdlc/PackedIntArray-0b/isEqual.adoc[`isEqual`] | Return `true` if this and the specified `other` array have the same value, and `false` otherwise. Two `PackedIntArray` arrays have the same value if they have the same length, and all corresponding elements (those at the same indices) have the same value. | xref:BloombergLP/bdlc/PackedIntArray-0b/length.adoc[`length`] | Return number of elements in this array. | xref:BloombergLP/bdlc/PackedIntArray-0b/operator_subs.adoc[`operator[]`] | Return the value of the element at the specified `index`. The behavior is undefined unless `index < length()`. | xref:BloombergLP/bdlc/PackedIntArray-0b/pop_back.adoc[`pop_back`] | Remove the last element from this array. The behavior is undefined unless `0 < length()` . | xref:BloombergLP/bdlc/PackedIntArray-0b/print.adoc[`print`] | Write the value of this array to the specified output `stream` in a human‐readable format, and return a reference to `stream`. Optionally specify an initial indentation `level`, whose absolute value is incremented recursively for nested arrays. If `level` is specified, optionally specify `spacesPerLevel`, whose absolute value indicates the number of spaces per indentation level for this and all of its nested arrays. If `level` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`). If `stream` is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice. | xref:BloombergLP/bdlc/PackedIntArray-0b/push_back.adoc[`push_back`] | Append an element having the specified `value` to the end of this array. | xref:BloombergLP/bdlc/PackedIntArray-0b/remove-02.adoc[`remove`] | `remove` overloads | xref:BloombergLP/bdlc/PackedIntArray-0b/removeAll.adoc[`removeAll`] | Remove all the elements from this array and set the storage required per element to one byte. | xref:BloombergLP/bdlc/PackedIntArray-0b/replace-05.adoc[`replace`] | `replace` overloads | xref:BloombergLP/bdlc/PackedIntArray-0b/reserveCapacity-03.adoc[`reserveCapacity`] | `reserveCapacity` overloads | xref:BloombergLP/bdlc/PackedIntArray-0b/resize.adoc[`resize`] | Set the length of this array to the specified `numElements`. If `numElements > length()`, the added elements are initialized to 0. | xref:BloombergLP/bdlc/PackedIntArray-0b/swap.adoc[`swap`] | Efficiently exchange the value of this array with the value of the specified `other` array. This method provides the no‐throw exception‐safety guarantee. The behavior is undefined unless this array was created with the same allocator as `other`. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/PackedIntArray-0b/maxSupportedBdexVersion.adoc[`maxSupportedBdexVersion`] | Return the `version` to be used with the `bdexStreamOut` method corresponding to the specified `serializationVersion`. See the `bslx` package‐level documentation for more information on BDEX streaming of value‐semantic types and containers. |=== == Specializations [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/PackedIntArray-08.adoc[`PackedIntArray<int>`] | This 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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlc/operator_not_eq-07.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` arrays do not have the same value, and `false` otherwise. Two `PackedIntArray` arrays do not have the same value if they do not have the same length, or if any corresponding elements (those at the same indices) do not have the same value. | xref:BloombergLP/bdlc/operator_eq-080.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` arrays have the same value, and `false` otherwise. Two `PackedIntArray` arrays have the same value if they have the same length, and all corresponding elements (those at the same indices) have the same value. | xref:BloombergLP/bdlc/swap-01.adoc[`swap`] | Exchange the values of the specified `a` and `b` objects. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#