bsl::allocator_traits::construct

Construct an ELEMENT_TYPE object at elementAddr.

Synopsis

Declared in <bslma_allocatortraits.h>

template<
    class ELEMENT_TYPE,
    class... Args>
static
void
construct(
    ALLOCATOR_TYPE& basicAllocator,
    ELEMENT_TYPE* elementAddr,
    Args&&... arguments);

Description

Construct an object of (template parameter) type ELEMENT_TYPE at the specified elementAddr, either by 1) calling the construct method on basicAllocator with elemAddr and the specified (variable number of) arguments if the (template parameter) type ALLOCATOR_TYPE defines such a method, or 2) forwarding the specified (variable number of) arguments to the constructor of ELEMENT_TYPE directly (and ignoring basicAllocator) otherwise. The behavior is undefined unless elementAddr refers to valid, uninitialized storage.

Parameters

NameDescription
basicAllocatorallocator used for construction if it provides construct
elementAddraddress at which to construct the object
argumentsconstructor arguments forwarded to ELEMENT_TYPE