BloombergLP::bslma::ConstructionUtil::construct

Create an object of (template parameter) TARGET_TYPE at the specified address, constructed by forwarding the specified argument1 and the (variable number of) additional specified arguments to the corresponding constructor of TARGET_TYPE. If the specified allocator is a bslma-compatible allocator and TARGET_TYPE supports bslma-style allocation, the allocator is passed to the constructor; otherwise, allocator is ignored. If the constructor throws, the memory at address is left in an unspecified state. Note that, in C++03, perfect forwarding is limited such that any lvalue reference in the arguments parameter pack is const-qualified when forwarded to the TARGET_TYPE constructor; only argument1 can be forwarded as an unqualified lvalue. The behavior is undefined unless address refers to a block that is of sufficient size and properly aligned for objects of TARGET_TYPE.

Synopsis

Declared in <bslma_constructionutil.h>

template<
    class TARGET_TYPE,
    class ALLOCATOR,
    class ARG1,
    class... ARGS>
static
void
construct(
    TARGET_TYPE* address,
    ALLOCATOR const& allocator,
    ARG1&& argument1,
    ARGS&&... arguments);