Insert a movable value, shifting subsequent elements.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<class TARGET_TYPE>
static
void
insert(
    TARGET_TYPE* toBegin,
    TARGET_TYPE* toEnd,
    bslmf::MovableRef<TARGET_TYPE> value,
    bslma::Allocator* allocator);

Description

Insert the specified value into the array of the (template parameter) type TARGET_TYPE at the specified toBegin address, shifting the elements from toBegin to the specified toEnd address by one position towards larger addresses. value is left in a valid but unspecified state. If a (copy or move) constructor or a (copy or move) assignment operator throws an exception, then any elements created after toEnd are destroyed and the elements in the range [toBegin .. toEnd )] are left in a valid but unspecified state. The behavior is undefined unless toBegin refers to sufficient space to hold at least toEnd ‐ toBegin + 1 elements.

Parameters

Name

Description

toBegin

insertion position within the destination array

toEnd

end of the populated destination range

value

movable value to insert

allocator

allocator used to supply memory if required

Created with MrDocs