[#BloombergLP-bslalg-ArrayPrimitives-copyConstruct-0c]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/ArrayPrimitives.adoc[ArrayPrimitives]::copyConstruct
:relfileprefix: ../../../
:mrdocs:

Copy&hyphen;construct elements from a range 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 ALLOCATOR,
    class FWD&lowbar;ITER,
    class SENTINEL&gt;
static
void
copyConstruct(
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toBegin,
    FWD&lowbar;ITER fromBegin,
    SENTINEL fromEnd,
    ALLOCATOR allocator);
----

== Description

Copy the elements of type `allocator&lowbar;traits&lt;ALLOCATOR&gt;&colon;&colon;value&lowbar;type` in the range beginning at the specified `fromBegin` location and ending immediately before the specified `fromEnd` location into the uninitialized array beginning at the specified `toBegin` location, using the specified `allocator` to supply memory (if required)&period; If a constructor throws an exception during this operation, the output array is left in an uninitialized state&period; The behavior is undefined unless `toBegin` refers to space sufficient to hold `fromEnd &hyphen; fromBegin` elements&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *toBegin*
| beginning of the uninitialized destination range
| *fromBegin*
| beginning of the source range
| *fromEnd*
| end of the source range (one past the last element)
| *allocator*
| allocator used to supply memory if required
|===


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