A drop‐in replacement for std::vector that stores small sequences inline.
Synopsis
Declared in <absl/container/inlined_vector.h>
template<
typename T,
size_t N,
typename A = std::allocator<T>>
class InlinedVector;
Description
An absl::InlinedVector is designed to be a drop‐in replacement for std::vector for use cases where the vector's size is sufficiently small that it can be inlined. If the inlined vector does grow beyond its estimated capacity, it will trigger an initial allocation on the heap, and will behave as a std::vector. The API of the absl::InlinedVector within this file is designed to cover the same API footprint as covered by std::vector.
Type Aliases
Name |
Description |
The allocator type used by the inlined vector. |
|
A const iterator over the elements. |
|
A pointer to a const element. |
|
A reference to a const element. |
|
A const reverse iterator over the elements. |
|
A signed integral type used for differences between iterators. |
|
An iterator over the elements. |
|
A pointer to an element. |
|
A reference to an element. |
|
A reverse iterator over the elements. |
|
An unsigned integral type used for sizes. |
|
The type of the elements stored in the inlined vector. |
Member Functions
Name |
Description |
|
Constructors |
|
Destroys the inlined vector and its elements. |
Assignment operators |
|
|
|
|
|
|
|
|
|
Returns the number of elements that could be stored in the inlined vector without requiring a reallocation. |
|
Returns a |
|
Returns a |
|
Destroys all elements in the inlined vector, setting the size to |
|
Returns a |
|
Returns a |
|
|
|
Constructs and inserts an element using |
|
Constructs and inserts an element using |
|
Returns whether the inlined vector contains no elements. |
|
|
|
|
|
|
|
Returns a copy of the inlined vector's allocator. |
|
|
|
Returns the maximum number of elements the inlined vector can hold. |
|
Subscript operators |
|
Destroys the element at |
|
|
|
|
|
|
|
Ensures that there is enough room for at least |
|
|
|
Attempts to reduce memory usage by moving elements to (or keeping elements in) the smallest available buffer sufficient for containing |
|
Returns the number of elements in the inlined vector. |
|
Swaps the contents of the inlined vector with |
Friends
Name |
Description |
Provides |
Non-Member Functions
Name |
Description |
Erases all elements that satisfy the predicate |
|
Tests for value‐inequality of two inlined vectors. |
|
Tests whether the value of an inlined vector is less than the value of another inlined vector using a lexicographical comparison algorithm. |
|
Tests whether the value of an inlined vector is less than or equal to the value of another inlined vector using a lexicographical comparison algorithm. |
|
Tests for value‐equality of two inlined vectors. |
|
Tests whether the value of an inlined vector is greater than the value of another inlined vector using a lexicographical comparison algorithm. |
|
Tests whether the value of an inlined vector is greater than or equal to the value of another inlined vector using a lexicographical comparison algorithm. |
|
Swaps the contents of two inlined vectors. |
Created with MrDocs