Create a vector from the specified iterator range.

Synopsis

Declared in <bslstl_vector.h>

template<class INPUT_ITER>
vector(
    INPUT_ITER first,
    INPUT_ITER last,
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Description

Create a vector, and insert (in order) each VALUE_TYPE object in the range starting at the specified first element, and ending immediately before the specified last element. 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 the number of elements in [first .. last)] exceeds the value returned by the method max_size. The (template parameter) type INPUT_ITER shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3]providing access to values of a type convertible to value_type, and value_type must be emplace‐constructible from *i into this vector, where i is a dereferenceable iterator in the range [first .. last)] (see {Requirements on VALUE_TYPE}). The behavior is undefined unless first and last refer to a range of valid values where first is at a position at or before last. Note that a bslma::Allocator * can be supplied for basicAllocator if the type ALLOCATOR is bsl::allocator (the default).

Parameters

Name

Description

first

the start of the iterator range

last

one past the end of the iterator range

basicAllocator

the allocator used to supply memory

Created with MrDocs