[#BloombergLP-bslalg-ArrayPrimitives-defaultConstruct-01]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/ArrayPrimitives.adoc[ArrayPrimitives]::defaultConstruct
:relfileprefix: ../../../
:mrdocs:

Value&hyphen;initialize elements into an uninitialized array&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;arrayprimitives&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TARGET&lowbar;TYPE&gt;
static
void
defaultConstruct(
    TARGET&lowbar;TYPE* begin,
    xref:BloombergLP/bslalg/ArrayPrimitives/size_type.adoc[size&lowbar;type] numElements,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator);
----

== Description

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *begin*
| beginning of the uninitialized destination range
| *numElements*
| number of elements to value&hyphen;initialize
| *allocator*
| allocator passed to element constructors when applicable
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
