Create a vector of initialSize elements each equal to value.
Synopsis
Declared in <bslstl_vector.h>
vector(
size_type initialSize,
VALUE_TYPE const& value,
ALLOCATOR const& basicAllocator = ALLOCATOR());
Description
Create a vector of the specified initialSize whose every element is a copy of the specified value. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not specified, a default‐constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used. Throw std::length_error if initialSize > max_size(). This method requires that the (template parameter) type VALUE_TYPE be copy‐insertable into this vector (see {Requirements on VALUE_TYPE}). Note that a bslma::Allocator * can be supplied for basicAllocator if the type ALLOCATOR is bsl::allocator (the default).
Parameters
Name |
Description |
initialSize |
number of elements to create |
value |
value copied into each element |
basicAllocator |
allocator used to supply memory |
Created with MrDocs