Value‐initialize elements into an uninitialized array.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<class TARGET_TYPE>
static
void
defaultConstruct(
    TARGET_TYPE* begin,
    size_type numElements,
    bslma::Allocator* allocator);

Description

Construct each of the elements of an array of the specified numElements of the parameterized TARGET_TYPE starting at the specified begin address by value‐initialization. If the (template parameter) ALLOCATOR type is derived from bslma::Allocator and TARGET_TYPE supports bslma allocators, then the specified allocator is passed to each TARGET_TYPE default constructor call. The behavior is undefined unless the output array contains at least numElements uninitialized elements after begin. If a TARGET_TYPE constructor throws an exception during this operation, then the destructor is called on any newly‐constructed elements, leaving the output array in an uninitialized state.

Parameters

Name

Description

begin

beginning of the uninitialized destination range

numElements

number of elements to value‐initialize

allocator

allocator passed to element constructors when applicable

Created with MrDocs