[#bsl-vector-029] = xref:bsl.adoc[bsl]::xref:bsl/vector-00d.adoc[vector]<long long> :relfileprefix: ../ :mrdocs: == Synopsis Declared in `<bslstl_vector.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> class xref:bsl/vector-00d.adoc[vector]<long long> : public xref:bsl/vectorBase-06a.adoc[vectorBase<long long>] ---- == Base Classes [cols="1,4"] |=== | Name| Description | `xref:bsl/vectorBase-06a.adoc[vectorBase<long long>]` | This class describes the basic layout for a vector class, to be included into the `vector` layout _before_ the allocator (provided by `bslalg::ContainerBase`) to take better advantage of cache prefetching. It is parameterized by `VALUE_TYPE` only, and implements the portion of `vector` that does not need to know about its (template parameter) type `ALLOCATOR` (in order to generate shorter debug strings). This class intentionally has *no* creators (other than the compiler‐generated ones). |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/vector-029/allocator_type.adoc[`allocator_type`] | This `typedef` is an alias to the (template parameter) `ALLOCATOR`. | xref:bsl/vector-029/const_iterator.adoc[`const_iterator`] | This `typedef` is an alias to `VALUE_TYPE const *`. | xref:bsl/vector-029/const_pointer.adoc[`const_pointer`] | This `typedef` is an alias to `AllocatorTraits::const_pointer`. | xref:bsl/vector-029/const_reference.adoc[`const_reference`] | This `typedef` is an alias to `VALUE_TYPE const&`. | xref:bsl/vector-029/const_reverse_iterator.adoc[`const_reverse_iterator`] | This `typedef` is an alias to `bsl::reverse_iterator<const_iterator>`. | xref:bsl/vector-029/difference_type.adoc[`difference_type`] | This `typedef` is an alias to `AllocatorTraits::difference_type`. | xref:bsl/vector-029/iterator.adoc[`iterator`] | This `typedef` is an alias to `VALUE_TYPE *`. | xref:bsl/vector-029/pointer.adoc[`pointer`] | This `typedef` is an alias to `AllocatorTraits::pointer`. | xref:bsl/vector-029/reference.adoc[`reference`] | This `typedef` is an alias to `VALUE_TYPE&`. | xref:bsl/vector-029/reverse_iterator.adoc[`reverse_iterator`] | This `typedef` is an alias to `bsl::reverse_iterator<iterator>`. | xref:bsl/vector-029/size_type.adoc[`size_type`] | This `typedef` is an alias to `AllocatorTraits::size_type`. | xref:bsl/vector-029/value_type.adoc[`value_type`] | This `typedef` is an alias to the (template parameter) `VALUE_TYPE`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/vector-029/2constructor-039.adoc[`vector`] [.small]#[constructor]# | Constructors | xref:bsl/vector-029/2destructor.adoc[`~vector`] [.small]#[destructor]# | Destroy this vector. | xref:bsl/vector-029/operator_assign-0a.adoc[`operator=`] | Assignment operators | xref:bsl/vectorBase-0f7/adopt.adoc[`adopt`] | Adopt all outstanding memory allocations associated with the specified `base` object. The behavior is undefined unless this object is in a default‐constructed state. | xref:bsl/vector-029/append_range.adoc[`append_range`] | Append to the end of this object the elements of the specified `range`. Note that `range` must meet the requirements of an input range and the values from `range` must have a type matching or convertible to (template parameter) `VALUE_TYPE`. | xref:bsl/vector-029/assign-02.adoc[`assign`] | `assign` overloads | xref:bsl/vector-029/assign_range.adoc[`assign_range`] | Assign to this object the elements of the specified `range`. Note that `range` must meet the requirements of an input range and the values from `range` must have a type matching or convertible to (template parameter) `VALUE_TYPE`. | xref:bsl/vector-029/at.adoc[`at`] | `at` overloads | xref:bsl/vector-029/back.adoc[`back`] | `back` overloads | xref:bsl/vector-029/begin.adoc[`begin`] | `begin` overloads | xref:bsl/vectorBase-0f7/capacity.adoc[`capacity`] | Return the capacity of this vector, i.e., the maximum number of elements for which resizing is guaranteed not to trigger a reallocation. | xref:bsl/vectorBase-0f7/cbegin.adoc[`cbegin`] | Return an iterator providing non‐modifiable access to the first element in this vector, and the past‐the‐end iterator if this vector is empty. | xref:bsl/vectorBase-0f7/cend.adoc[`cend`] | Return the past‐the‐end (forward) iterator providing non‐modifiable access to this vector. | xref:bsl/vector-029/clear.adoc[`clear`] | Remove all elements from this vector making its size 0. Note that although this vector is empty after this method returns, it preserves the same capacity it had before the method was called. | xref:bsl/vectorBase-0f7/crbegin.adoc[`crbegin`] | Return a reverse iterator providing non‐modifiable access to the last element in this vector, and the past‐the‐end reverse iterator if this vector is empty. | xref:bsl/vectorBase-0f7/crend.adoc[`crend`] | Return the past‐the‐end reverse iterator providing non‐modifiable access to this vector. | xref:bsl/vector-029/data.adoc[`data`] | `data` overloads | xref:bsl/vector-029/emplace.adoc[`emplace`] | Insert at the specified `position` in this vector a newly created `value_type` object, constructed by forwarding `get_allocator()` (if required) and the specified (variable number of) `arguments` to the corresponding constructor of `value_type`, and return an iterator referring to the newly created and inserted element. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of `value_type`), `*this` is unaffected. Throw `std::length_error` if `size() == max_size()`. The behavior is undefined unless `position` is an iterator in the range `[begin() .. end()]` (both endpoints included). This method requires that the (template parameter) type `VALUE_TYPE` be `move‐insertable` into this vector and `emplace‐constructible` from `arguments` (see {Requirements on `VALUE_TYPE`}). | xref:bsl/vector-029/emplace_back.adoc[`emplace_back`] | Append to the end of this vector a newly created `value_type` object, constructed by forwarding `get_allocator()` (if required) and the specified (variable number of) `arguments` to the corresponding constructor of `value_type`. Return a reference providing modifiable access to the inserted element. If an exception is thrown (other than by the move constructor of a non‐copy‐insertable `value_type`), `*this` is unaffected. Throw `std::length_error` if `size() == max_size()`. This method requires that the (template parameter) type `VALUE_TYPE` be `move‐insertable` into this vector and `emplace‐constructible` from `arguments` (see {Requirements on `VALUE_TYPE`}). | xref:bsl/vectorBase-0f7/empty.adoc[`empty`] | Return `true` if this vector has size 0, and `false` otherwise. | xref:bsl/vector-029/end.adoc[`end`] | `end` overloads | xref:bsl/vector-029/erase-0b.adoc[`erase`] | `erase` overloads | xref:bsl/vector-029/front.adoc[`front`] | `front` overloads | xref:bsl/vector-029/get_allocator.adoc[`get_allocator`] | Return (a copy of) the allocator used for memory allocation by this vector. | xref:bsl/vector-029/insert-02.adoc[`insert`] | `insert` overloads | xref:bsl/vector-029/insert_range.adoc[`insert_range`] | Insert at the specified `position` in this object the elements of the specified `range`. Note that `range` must meet the requirements of an input range and the values from `range` must have a type matching or convertible to (template parameter) `VALUE_TYPE`. | xref:bsl/vector-029/max_size.adoc[`max_size`] | Return a theoretical upper bound on the largest number of elements that this vector could possibly hold. Note that there is no guarantee that the vector can successfully grow to the returned size, or even close to that size without running out of resources. Also note that requests to create a vector longer than this number of elements are guaranteed to raise a `std::length_error` exception. | xref:bsl/vector-029/operator_subs.adoc[`operator[]`] | Subscript operators | xref:bsl/vector-029/pop_back.adoc[`pop_back`] | Erase the last element from this vector. The behavior is undefined if this vector is empty. | xref:bsl/vector-029/push_back-07.adoc[`push_back`] | `push_back` overloads | xref:bsl/vector-029/rbegin.adoc[`rbegin`] | `rbegin` overloads | xref:bsl/vector-029/rend.adoc[`rend`] | `rend` overloads | xref:bsl/vector-029/reserve.adoc[`reserve`] | Change the capacity of this vector to the specified `newCapacity`. If an exception is thrown (other than by the move constructor of a non‐copy‐insertable `value_type`), `*this` is unaffected. Throw `bsl::length_error` if `newCapacity > max_size()`. This method requires that the (template parameter) type `VALUE_TYPE` be `move‐insertable` into this vector (see {Requirements on `VALUE_TYPE`}). Note that the capacity of this vector after this operation has completed may be greater than `newCapacity`. | xref:bsl/vector-029/resize-0d.adoc[`resize`] | `resize` overloads | xref:bsl/vector-029/shrink_to_fit.adoc[`shrink_to_fit`] | Reduce the capacity of this vector to its size. If an exception is thrown (other than by the move constructor of a non‐copy‐insertable `value_type`), `*this` is unaffected. Note that this method has no effect if the capacity is equivalent to the size. | xref:bsl/vectorBase-0f7/size.adoc[`size`] | Return the number of elements in this vector. | xref:bsl/vector-029/swap.adoc[`swap`] | Exchange the value of this object with that of the specified `other` object; also exchange the allocator of this object with that of `other` if the (template parameter) type `ALLOCATOR` has the `propagate_on_container_swap` trait, and do not modify either allocator otherwise. This method provides the no‐throw exception‐safety guarantee. This operation has `O[1]` complexity if either this object was created with the same allocator as `other` or `ALLOCATOR` has the `propagate_on_container_swap` trait; otherwise, it has `O[n + m]` complexity, where `n` and `m` are the number of elements in this object and `other`, respectively. Note that this method`s support for swapping objects created with different allocators when `ALLOCATOR` does not have the `propagate_on_container_swap` trait is a departure from the C++ Standard. |=== == Protected Data Members [cols="1,4"] |=== | Name| Description | xref:bsl/vectorBase-0f7/d_capacity.adoc[`d_capacity`] | Capacity of data storage in number of elements. | xref:bsl/vectorBase-0f7/d_dataBegin_p.adoc[`d_dataBegin_p`] | Beginning of data storage (owned). | xref:bsl/vectorBase-0f7/d_dataEnd_p.adoc[`d_dataEnd_p`] | One past the end of data storage. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#