Destructively move elements while inserting a source range.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<
    class ALLOCATOR,
    class FWD_ITER,
    class SENTINEL>
static
void
destructiveMoveAndInsert(
    bsl::allocator_traits<ALLOCATOR>::pointer toBegin,
    bsl::allocator_traits<ALLOCATOR>::pointer* fromEndPtr,
    bsl::allocator_traits<ALLOCATOR>::pointer fromBegin,
    bsl::allocator_traits<ALLOCATOR>::pointer position,
    bsl::allocator_traits<ALLOCATOR>::pointer fromEnd,
    FWD_ITER first,
    SENTINEL last,
    size_type numElements,
    ALLOCATOR allocator);

Description

Move the elements of type allocator_traits<ALLOCATOR>::value_type in the range beginning at the specified fromBegin location and ending immediately before the specified fromEnd location into the uninitialized array beginning at the specified toBegin location using the specified allocator to supply memory (if required), 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 (template parameter) type FWD_ITER and ending immediately before the specified last sentinel or iterator, ensuring that the specified fromEndPtr points to the first uninitialized element in [fromBegin .. fromEnd)] as the elements are moved from source to destination. On return, the elements in the input range are invalid, i.e., their destructors must not be called after this operation returns. If a constructor throws an exception during this operation, the output array is left in an uninitialized state. If a constructor other than the copy or move constructor throws an exception during this operation, the input array is unaffected; otherwise, if a copy or move constructor throws an exception during this operation, the input elements in the range [fromBegin .. *fromEndPtr)] are left in a valid but unspecified state and the remaining portion of the input array is left in an uninitialized state. The behavior is undefined unless fromBegin <= position <= fromEnd and toBegin refers to space sufficient to hold fromEnd ‐ fromBegin + numElements elements.

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