Destructively move elements while inserting a source range.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<
    class TARGET_TYPE,
    class FWD_ITER,
    class SENTINEL>
static
void
destructiveMoveAndInsert(
    TARGET_TYPE* toBegin,
    TARGET_TYPE** fromEndPtr,
    TARGET_TYPE* fromBegin,
    TARGET_TYPE* position,
    TARGET_TYPE* fromEnd,
    FWD_ITER first,
    SENTINEL last,
    size_type numElements,
    bslma::Allocator* allocator);

Description

Move the elements of the parameterized TARGET_TYPE in the array starting at the specified fromBegin address and ending immediately before the specified fromEnd address into an uninitialized array of TARGET_TYPE at the specified toBegin address, inserting at the specified position (after translating from fromBegin to toBegin) the specified numElements copies of the non‐modifiable elements from the range starting at the specified first iterator of the parameterized FWD_ITER type and ending immediately before the specified last sentinel or iterator. Keep the pointer at the specified fromEndPtr to point to the first uninitialized element in [fromBegin, fromEnd)] as the elements are moved from source to destination. The behavior is undefined unless fromBegin <= position <= fromEnd, the destination array contains at least (fromEnd ‐ fromBegin) + numElements uninitialized elements after toBegin, and numElements is the distance from first to last. If a copy constructor or assignment operator for TARGET_TYPE throws an exception, then any elements created in the output array are destroyed and the elements in the range [ fromBegin, *fromEndPtr )] will have unspecified but valid values.

Parameters

Name

Description

toBegin

beginning of the uninitialized destination range

fromEndPtr

loads the end of the remaining valid source range

fromBegin

beginning of the source range

position

insertion position within the source range

fromEnd

end of the source range (one past the last element)

first

beginning of the range of elements to insert

last

end of the range of elements to insert

numElements

number of elements to insert from [first .. last)]

allocator

allocator used to supply memory if required

Created with MrDocs