BloombergLP::bslalg::ArrayPrimitives::copyConstruct

Copy-construct elements from a range into an uninitialized array.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<
    class TARGET_TYPE,
    class FWD_ITER,
    class SENTINEL>
static
void
copyConstruct(
    TARGET_TYPE* toBegin,
    FWD_ITER fromBegin,
    SENTINEL fromEnd,
    bslma::Allocator* allocator);

Description

Copy into an uninitialized array of (the template parameter) TARGET_TYPE beginning at the specified toBegin address, the elements in the array of TARGET_TYPE starting at the specified fromBegin address and ending immediately before the specified fromEnd address. 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 invocation of the TARGET_TYPE copy constructor. If a TARGET_TYPE constructor throws an exception during the operation, then the destructor is called on any newly-constructed elements, leaving the output array in an uninitialized state.

Parameters

NameDescription
toBeginbeginning of the uninitialized destination range
fromBeginbeginning of the source range
fromEndend of the source range (one past the last element)
allocatorallocator passed to element constructors when applicable