This space‐efficient value‐semantic array class represents a sequence of STORAGE::EightByteStorageType elements; STORAGE::EightByteStorageType 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.

Synopsis

Declared in <bdlc_packedintarray.h>

template<class STORAGE>
class PackedIntArrayImp;

Type Aliases

Name

Description

ElementType

Element storage type used by this packed array implementation.

Member Functions

Name

Description

PackedIntArrayImp [constructor]

Constructors

~PackedIntArrayImp [destructor]

Destroy this object

operator=

Assign to this array the value of the specified rhs array, and return a reference providing modifiable access to this array.

allocator

Return the allocator used by this array to supply memory.

append

append overloads

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.

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.

bytesPerElement

Return the number of bytes currently used to store each element in this array.

capacity

Return the number of elements this array can hold in terms of the current data type used to store its elements.

insert

insert overloads

isEmpty

Return true if there are no elements in this array, and false otherwise.

isEqual

Return true if this and the specified other array have the same value, and false otherwise. Two PackedIntArrayImp arrays have the same value if they have the same length, and all corresponding elements (those at the same indices) have the same value.

length

Return number of elements in this array.

operator[]

Return the value of the element at the specified index. The behavior is undefined unless index < length().

pop_back

Remove the last element from this array. The behavior is undefined unless 0 < length() .

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.

push_back

Append an element having the specified value to the end of this array.

remove

remove overloads

removeAll

Remove all the elements from this array and set the storage required per element to one byte.

replace

replace overloads

reserveCapacity

reserveCapacity overloads

reserveCapacityImp

Make the capacity of this array at least the specified requiredCapacityInBytes. This method has no effect if the current capacity meets or exceeds the required capacity.

resize

Set the length of this array to the specified numElements. If numElements > length(), the added elements are initialized to 0.

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

Name

Description

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.

Static Data Members

Name

Description

k_MAX_CAPACITY

Maximum capacity in bytes for this packed array implementation.

Specializations

Name

Description

PackedIntArrayImp<PackedIntArrayImp_Unsigned>

This space‐efficient value‐semantic array class represents a sequence of STORAGE::EightByteStorageType elements; STORAGE::EightByteStorageType 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.

Created with MrDocs