Destructively move elements while inserting default‐initialized ones.
Synopsis
Declared in <bslalg_arrayprimitives.h>
template<class TARGET_TYPE>
static
void
destructiveMoveAndInsert(
TARGET_TYPE* toBegin,
TARGET_TYPE** fromEndPtr,
TARGET_TYPE* fromBegin,
TARGET_TYPE* position,
TARGET_TYPE* fromEnd,
size_type numElements,
bslma::Allocator* allocator);
Description
Move the elements of the (template parameter) TARGET_TYPE in the starting at the specified fromBegin address and ending immediately before the specified fromEnd address 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) numElements objects initialized to default values, 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 default constructor throws an exception, 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) |
numElements |
number of default‐initialized elements to insert |
allocator |
allocator used to supply memory if required |
Created with MrDocs