[#bsl-allocator_traits-0108-construct] = xref:bsl.adoc[bsl]::xref:bsl/allocator_traits-0108.adoc[allocator_traits]::construct :relfileprefix: ../../ :mrdocs: Construct an `ELEMENT_TYPE` object at `elementAddr`. == Synopsis Declared in `<bslma_allocatortraits.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | *basicAllocator* | allocator used for construction if it provides `construct` | *elementAddr* | address at which to construct the object | *arguments* | constructor arguments forwarded to `ELEMENT_TYPE` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#