STL‐compliant sequence container conforming to the bslma model.
Synopsis
Declared in <bslstl_vector.h>
template<
class VALUE_TYPE,
class ALLOCATOR = allocator<VALUE_TYPE>>
class vector
: public vectorBase<VALUE_TYPE>
Description
This class template provides an STL‐compliant vector that conforms to the bslma::Allocator model. For the requirements of a vector class, consult the C++11 standard. In particular, this implementation offers the general rules that:
1. A call to any method that would result in a vector having a size or capacity greater than the value returned by max_size triggers a call to bslstl::StdExceptUtil::throwLengthError. 2. A call to an at method that attempts to access a position outside of the valid range of a vector triggers a call to bslstl::StdExceptUtil::throwOutOfRange.
Note that portions of the standard methods are implemented in vectorBase, which is parameterized on only VALUE_TYPE in order to generate smaller debug strings.
This class: * supports a complete set of value‐semantic operations
-
except for
BDEXserialization * is exception‐neutral * is alias‐safe * isconstthread‐safe For terminology see {`bsldoc_glossary`}.
In addition, the following members offer a full guarantee of rollback: if an exception is thrown during the invocation of push_back or insert with a single element at the end of a pre‐existing object, the object is left in a valid state and its value is unchanged.
Base Classes
Name |
Description |
Allocator‐independent storage layout shared by |
Type Aliases
Name |
Description |
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
|
This |
Member Functions
Name |
Description |
|
Constructors |
|
Destroy this vector. |
Assignment operators |
|
Adopt memory allocations from the specified |
|
Append elements from a range to this vector. |
|
Assign a new value to this vector. |
|
Assign elements from a range to this vector. |
|
|
|
|
|
|
|
Return the capacity of this vector, i.e., the maximum number of elements for which resizing is guaranteed not to trigger a reallocation. |
|
Return a const iterator to the first element. |
|
Return the past‐the‐end (forward) iterator providing non‐modifiable access to this vector. |
|
Remove all elements from this vector. |
|
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. |
|
Return the past‐the‐end reverse iterator providing non‐modifiable access to this vector. |
|
|
|
Emplace a newly constructed element at the specified position. |
|
Emplace a newly constructed element at the end. |
|
Return |
|
|
|
Erase elements from this vector. |
|
|
|
Return (a copy of) the allocator used for memory allocation by this vector. |
|
|
|
Insert the elements of |
|
Return a theoretical upper bound on this vector's size. |
|
Subscript operators |
|
Erase the last element from this vector. The behavior is undefined if this vector is empty. |
|
|
|
|
|
|
|
Increase capacity to at least |
|
|
|
Request that unused capacity be released. |
|
Return the number of elements in this vector. |
|
Exchange the value of this object with |
Protected Data Members
Name |
Description |
Capacity of data storage in number of elements. |
|
Beginning of data storage (owned). |
|
One past the end of data storage. |
Specializations
Name |
Description |
This partial specialization of |
Deduction Guides
Name |
Description |
Deduce the template parameter |
|
Deduce template arguments for |
|
Deduce the template parameter |
|
Deduce the template parameter |
|
Deduce the template parameter |
|
|
Deduce the template parameters |
Non-Member Functions
Name |
Description |
Assign the specified |
|
Erase all the elements in the specified vector |
|
Erase all the elements in the specified vector |
|
Perform a three‐way comparison of the operands. |
|
Return whether the operands have the same value. |
|
Exchange the contents of two vectors. |
|
Invoke the specified |
|
Apply the specified |
|
Reserve capacity for the specified |
|
Resize the specified |
|
Return the number of elements in the specified |
|
Return |
|
|
Specialization of |
Created with MrDocs