BloombergLP::bslalg::ArrayPrimitives::moveInsert

Move-insert a source range, shifting subsequent elements.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<class TARGET_TYPE>
static
void
moveInsert(
    TARGET_TYPE* toBegin,
    TARGET_TYPE* toEnd,
    TARGET_TYPE** fromEndPtr,
    TARGET_TYPE* fromBegin,
    TARGET_TYPE* fromEnd,
    size_type numElements,
    bslma::Allocator* allocator);

Description

Move the elements of the (template parameter) TARGET_TYPE in the array starting at the specified toBegin address and ending immediately before the specified toEnd address by the specified numElements positions towards larger addresses, and fill the numElements at the toBegin address by moving the elements from the array starting at the specified fromBegin and ending immediately before the specified fromEnd address. Keep the iterator at the specified fromEndPtr address pointing to the end of the range as the elements from [ fromBegin, fromEnd )] are moved from source to destination. The behavior is undefined unless the destination array contains numElements uninitialized elements after toEnd, numElements is the distance from fromBegin to fromEnd, and the input and destination arrays do not overlap. If a copy constructor or assignment operator for TARGET_TYPE throws an exception, then any elements created after toEnd are destroyed, the elements in the ranges [ toBegin, toEnd)] and [ fromBegin, *fromEndPtr )] will have unspecified, but valid, values, and the elements in [ *fromEndPtr, fromEnd )] will be destroyed.

Parameters

NameDescription
toBegininsertion position within the destination array
toEndend of the populated destination range
fromEndPtrloads the end of the remaining valid source range
fromBeginbeginning of the source range to move-insert
fromEndend of the source range to move-insert
numElementsnumber of elements to move-insert
allocatorallocator used to supply memory if required