BloombergLP::bslalg::ArrayPrimitives::insert

insert overloads

Synopses

Declared in <bslalg_arrayprimitives.h>

Insert the specified value into the array of allocator_traits<ALLOCATOR>::value_type objects at the specified toBegin location, shifting forward the elements from toBegin to the specified toEnd location by one position. 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.

template<class ALLOCATOR>
static
void
insert(
    bsl::allocator_traits<ALLOCATOR>::pointer toBegin,
    bsl::allocator_traits<ALLOCATOR>::pointer toEnd,
    bslmf::MovableRef<bsl::allocator_traits<ALLOCATOR>::value_type> value,
    ALLOCATOR allocator);
» more...

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.

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

Insert the specified numElements copies of the specified value into the array of type allocator_traits<ALLOCATOR>::value_type starting at the specified toBegin location, shifting forward the elements from toBegin to the specified toEnd location by numElements positions. If a (copy or move) constructor or a (copy or move) assignment operator throws an exception, 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 space sufficient to hold at least toEnd - toBegin + numElements elements.

template<class ALLOCATOR>
static
void
insert(
    bsl::allocator_traits<ALLOCATOR>::pointer toBegin,
    bsl::allocator_traits<ALLOCATOR>::pointer toEnd,
    bsl::allocator_traits<ALLOCATOR>::value_type const& value,
    size_type numElements,
    ALLOCATOR allocator);
» more...

Insert the specified numElements copies of the specified value into the array of (template parameter) TARGET_TYPE starting at the specified toBegin address and ending immediately before the specified toEnd address, shifting the elements in the array by numElements positions towards larger addresses. The behavior is undefined unless the destination array contains at least numElements uninitialized elements after toEnd. If a copy constructor or assignment operator for TARGET_TYPE throws an exception, then any elements created after toEnd are destroyed and the elements in the range [ toBegin, toEnd )] will have unspecified, but valid, values.

template<class TARGET_TYPE>
static
void
insert(
    TARGET_TYPE* toBegin,
    TARGET_TYPE* toEnd,
    TARGET_TYPE const& value,
    size_type numElements,
    bslma::Allocator* allocator);
» more...

Same as the preceding insert overload, taking pointer iterators.

template<
    class ALLOCATOR,
    class SOURCE_TYPE>
static
void
insert(
    bsl::allocator_traits<ALLOCATOR>::pointer toBegin,
    bsl::allocator_traits<ALLOCATOR>::pointer toEnd,
    SOURCE_TYPE* fromBegin,
    SOURCE_TYPE* fromEnd,
    size_type numElements,
    ALLOCATOR allocator);
» more...

Same as the preceding overload, taking pointer iterators.

template<
    class TARGET_TYPE,
    class SOURCE_TYPE>
static
void
insert(
    TARGET_TYPE* toBegin,
    TARGET_TYPE* toEnd,
    SOURCE_TYPE* fromBegin,
    SOURCE_TYPE* fromEnd,
    size_type numElements,
    bslma::Allocator* allocator);
» more...

TBD: improve comment 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.

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);
» more...

Insert, into the array at the specified toBegin location, the specified numElements from the range starting at the specified fromBegin iterators of the (template parameter) FWD_ITER type (or the (template parameter) SOURCE_TYPE *) and ending immediately before the specified fromEnd sentinels or iterators of the (template parameter) SENTINEL type (or the (template parameter) SOURCE_TYPE *), into the array of elements of the parameterized TARGET_TYPE starting at the specified toBegin address and ending immediately before the specified toEnd address, shifting the elements in the array by numElements positions towards larger addresses. 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 for TARGET_TYPE throws an exception, then any elements created after toEnd are destroyed and the elements in the range [ toBegin, toEnd )] will have unspecified, but valid, values.

template<
    class TARGET_TYPE,
    class FWD_ITER,
    class SENTINEL>
static
void
insert(
    TARGET_TYPE* toBegin,
    TARGET_TYPE* toEnd,
    FWD_ITER fromBegin,
    SENTINEL fromEnd,
    size_type numElements,
    bslma::Allocator* allocator);
» more...