Insert a source range, shifting subsequent elements.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<
    class ALLOCATOR,
    class FWD_ITER,
    class SENTINEL>
static
void
insert(
    bsl::allocator_traits<ALLOCATOR>::pointer toBegin,
    bsl::allocator_traits<ALLOCATOR>::pointer toEnd,
    FWD_ITER fromBegin,
    SENTINEL fromEnd,
    size_type numElements,
    ALLOCATOR allocator);

Description

Insert the specified numElements from the range starting at the specified fromBegin of (template parameter) FWD_ITER type (or template parameter SOURCE_TYPE *) and ending immediately before the specified fromEnd sentinels or iterators of (template parameter) SENTINEL type (or template parameter SOURCE_TYPE *), into the array of elements of type given by the allocator_traits class template for (template parameter) ALLOCATOR, starting at the specified toBegin address, shifting forward the elements in the array by numElements positions. The behavior is undefined unless the destination array contains numElements uninitialized elements after toEnd, numElements is the distance between fromBegin and fromEnd, and the input array and the destination array do not overlap. If a copy constructor or assignment operator throws an exception, then any elements created after toEnd are destroyed and the elements in the range [ toBegin, toEnd )] will have valid but unspecified values.

Parameters

Name

Description

toBegin

insertion position within the destination array

toEnd

end of the populated destination range

fromBegin

beginning of the source range to insert

fromEnd

end of the source range to insert

numElements

number of elements to insert from the source range

allocator

allocator used to supply memory if required

Created with MrDocs