std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::construct

Header: <scoped_allocator>

Constructs an object in allocated, but not initialized storage pointed to by p using the outer allocator and the provided constructor arguments. If the object is of a type that itself uses allocators, or if it is std::pair(until C++20), passes the inner allocator down to the constructed object.

# Declarations

template< class T, class... Args >
void construct( T* p, Args&&... args );
template< class T1, class T2, class... Args1, class... Args2 >
void construct( std::pair<T1, T2>* p, std::piecewise_construct_t,
std::tuple<Args1...> x, std::tuple<Args2...> y );

(until C++20)

template< class T1, class T2 >
void construct( std::pair<T1, T2>* p );

(until C++20)

template< class T1, class T2, class U, class V >
void construct( std::pair<T1, T2>* p, U&& x, V&& y );

(until C++20)

template< class T1, class T2, class U, class V >
void construct( std::pair<T1, T2>* p, const std::pair<U, V>& xy );

(until C++20)

template< class T1, class T2, class U, class V >
void construct( std::pair<T1, T2>* p, std::pair<U, V>&& xy );

(until C++20)

Helper function templates
template < class T, class... Args >
std::tuple</* see below */> /*concat-args*/( std::tuple<Args...>&& tup );

(exposition only*) (until C++20)

# Parameters

# Notes

This function is called (through std::allocator_traits) by any allocator-aware object, such as std::vector, that was given a std::scoped_allocator_adaptor as the allocator to use. Since inner_allocator_type is itself a specialization of std::scoped_allocator_adaptor, this function will also be called when the allocator-aware objects constructed through this function start constructing their own members.

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2203C++11inner allocators were obtained by value-initializingan inner_allocator_type objectobtained by calling inner_allocator()
LWG 2511(P0475R1)C++11concat-args might copy elements of std::tupleseliminated all element copy operations
LWG 2586C++11only constructions frominner_allocator_type rvalues were checkedchecks constructions from non-constinner_allocator_type lvalues instead
LWG 2975C++11overload (1) was not constrainedconstrained to refuse std::pair

# See also