[#absl-InlinedVector] = xref:absl.adoc[absl]::InlinedVector :relfileprefix: ../ :mrdocs: A drop‐in replacement for `std::vector` that stores small sequences inline. == Synopsis Declared in `<absl/container/inlined_vector.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:absl/InlinedVector/allocator_type.adoc[`allocator_type`] | The allocator type used by the inlined vector. | xref:absl/InlinedVector/const_iterator.adoc[`const_iterator`] | A const iterator over the elements. | xref:absl/InlinedVector/const_pointer.adoc[`const_pointer`] | A pointer to a const element. | xref:absl/InlinedVector/const_reference.adoc[`const_reference`] | A reference to a const element. | xref:absl/InlinedVector/const_reverse_iterator.adoc[`const_reverse_iterator`] | A const reverse iterator over the elements. | xref:absl/InlinedVector/difference_type.adoc[`difference_type`] | A signed integral type used for differences between iterators. | xref:absl/InlinedVector/iterator.adoc[`iterator`] | An iterator over the elements. | xref:absl/InlinedVector/pointer.adoc[`pointer`] | A pointer to an element. | xref:absl/InlinedVector/reference.adoc[`reference`] | A reference to an element. | xref:absl/InlinedVector/reverse_iterator.adoc[`reverse_iterator`] | A reverse iterator over the elements. | xref:absl/InlinedVector/size_type.adoc[`size_type`] | An unsigned integral type used for sizes. | xref:absl/InlinedVector/value_type.adoc[`value_type`] | The type of the elements stored in the inlined vector. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/InlinedVector/2constructor-05.adoc[`InlinedVector`] [.small]#[constructor]# | Constructors | xref:absl/InlinedVector/2destructor.adoc[`~InlinedVector`] [.small]#[destructor]# | Destroys the inlined vector and its elements. | xref:absl/InlinedVector/operator_assign-0f.adoc[`operator=`] | Assignment operators | xref:absl/InlinedVector/assign-06.adoc[`assign`] | `assign` overloads | xref:absl/InlinedVector/at-0f.adoc[`at`] | `at` overloads | xref:absl/InlinedVector/back-00.adoc[`back`] | `back` overloads | xref:absl/InlinedVector/begin-0be.adoc[`begin`] | `begin` overloads | xref:absl/InlinedVector/capacity.adoc[`capacity`] | Returns the number of elements that could be stored in the inlined vector without requiring a reallocation. | xref:absl/InlinedVector/cbegin.adoc[`cbegin`] | Returns a `const_iterator` to the beginning of the inlined vector. | xref:absl/InlinedVector/cend.adoc[`cend`] | Returns a `const_iterator` to the end of the inlined vector. | xref:absl/InlinedVector/clear.adoc[`clear`] | Destroys all elements in the inlined vector, setting the size to `0` and preserving capacity. | xref:absl/InlinedVector/crbegin.adoc[`crbegin`] | Returns a `const_reverse_iterator` from the end of the inlined vector. | xref:absl/InlinedVector/crend.adoc[`crend`] | Returns a `const_reverse_iterator` from the beginning of the inlined vector. | xref:absl/InlinedVector/data-03.adoc[`data`] | `data` overloads | xref:absl/InlinedVector/emplace.adoc[`emplace`] | Constructs and inserts an element using `args...` in the inlined vector at `pos`, returning an `iterator` pointing to the newly emplaced element. | xref:absl/InlinedVector/emplace_back.adoc[`emplace_back`] | Constructs and inserts an element using `args...` in the inlined vector at `end()`, returning a `reference` to the newly emplaced element. | xref:absl/InlinedVector/empty.adoc[`empty`] | Returns whether the inlined vector contains no elements. | xref:absl/InlinedVector/end-00.adoc[`end`] | `end` overloads | xref:absl/InlinedVector/erase-00.adoc[`erase`] | `erase` overloads | xref:absl/InlinedVector/front-03.adoc[`front`] | `front` overloads | xref:absl/InlinedVector/get_allocator.adoc[`get_allocator`] | Returns a copy of the inlined vector's allocator. | xref:absl/InlinedVector/insert-08.adoc[`insert`] | `insert` overloads | xref:absl/InlinedVector/max_size.adoc[`max_size`] | Returns the maximum number of elements the inlined vector can hold. | xref:absl/InlinedVector/operator_subs-02.adoc[`operator[]`] | Subscript operators | xref:absl/InlinedVector/pop_back.adoc[`pop_back`] | Destroys the element at `back()`, reducing the size by `1`. | xref:absl/InlinedVector/push_back-03.adoc[`push_back`] | `push_back` overloads | xref:absl/InlinedVector/rbegin-07.adoc[`rbegin`] | `rbegin` overloads | xref:absl/InlinedVector/rend-01.adoc[`rend`] | `rend` overloads | xref:absl/InlinedVector/reserve.adoc[`reserve`] | Ensures that there is enough room for at least `n` elements. | xref:absl/InlinedVector/resize-08.adoc[`resize`] | `resize` overloads | xref:absl/InlinedVector/shrink_to_fit.adoc[`shrink_to_fit`] | Attempts to reduce memory usage by moving elements to (or keeping elements in) the smallest available buffer sufficient for containing `size()` elements. | xref:absl/InlinedVector/size.adoc[`size`] | Returns the number of elements in the inlined vector. | xref:absl/InlinedVector/swap.adoc[`swap`] | Swaps the contents of the inlined vector with `other`. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:absl/AbslHashValue-06.adoc[absl::AbslHashValue]` | Provides `absl::Hash` support for `absl::InlinedVector`. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/erase_if-049.adoc[`erase_if`] | Erases all elements that satisfy the predicate `pred` from the inlined vector `v`. | xref:absl/operator_not_eq-053e.adoc[`operator!=`] | Tests for value‐inequality of two inlined vectors. | xref:absl/operator_lt-0b.adoc[`operator<`] | Tests whether the value of an inlined vector is less than the value of another inlined vector using a lexicographical comparison algorithm. | xref:absl/operator_le-00e1.adoc[`operator<=`] | 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. | xref:absl/operator_eq-0df.adoc[`operator==`] | Tests for value‐equality of two inlined vectors. | xref:absl/operator_gt-07.adoc[`operator>`] | Tests whether the value of an inlined vector is greater than the value of another inlined vector using a lexicographical comparison algorithm. | xref:absl/operator_ge-041.adoc[`operator>=`] | 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. | xref:absl/swap-0a.adoc[`swap`] | Swaps the contents of two inlined vectors. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#