BloombergLP::bslalg::ArrayPrimitives::erase

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

Synopsis

Declared in <bslalg_arrayprimitives.h>

template<class ALLOCATOR>
static
void
erase(
    bsl::allocator_traits<ALLOCATOR>::pointer first,
    bsl::allocator_traits<ALLOCATOR>::pointer middle,
    bsl::allocator_traits<ALLOCATOR>::pointer last,
    ALLOCATOR allocator);

Description

Destroy the elements of type given by the allocator_traits class template for (template parameter) ALLOCATOR starting at the specified first pointer and ending immediately before the specified middle pointer, and move the elements in the array starting at middle and ending at the specified last pointer down to the first pointer. 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

NameDescription
firstbeginning of the range to erase
middleend of the range to erase (one past the last)
lastend of the populated array range
allocatorallocator used to destroy elements