Erase a range of elements and close the gap by moving.

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<class TARGET_TYPE>
static
void
erase(
    TARGET_TYPE* first,
    TARGET_TYPE* middle,
    TARGET_TYPE* last,
    bslma::Allocator* allocator = 0);

Description

Destroy the elements of the parameterized TARGET_TYPE in the array starting at the specified first address and ending immediately before the specified middle address, and move the elements in the array starting at middle and ending at the specified last address down to the first address. If an assignment throws an exception during this process, all of the elements in the range [ first, last )] will have unspecified but valid values, and no elements are destroyed. The behavior is undefined unless first <= middle <= last.

Parameters

Name

Description

first

beginning of the range to erase

middle

end of the range to erase (one past the last)

last

end of the populated array range

allocator

allocator used to destroy elements

Created with MrDocs