bsl::deque::emplace

Emplace a newly constructed element before position.

Synopsis

Declared in <bslstl_deque.h>

template<class... Args>
deque<VALUE_TYPE, ALLOCATOR>::iterator
emplace(
    const_iterator position,
    Args&&... arguments);

Description

Insert at the specified position in this deque a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type, and return an iterator providing modifiable access to the newly created and inserted element. If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of value_type), this method has no effect. This method requires that the (template parameter) VALUE_TYPE be move-insertable into this deque and emplace-constructible from arguments (see {Requirements on VALUE_TYPE}). The behavior is undefined unless position is an iterator in the range [cbegin() .. cend()] (both endpoints included).

Return Value

iterator to the newly emplaced element

Parameters

NameDescription
positioniterator before which to emplace
argumentsconstructor arguments for the new element