std::pmr::polymorphic_allocator<T>::construct

Constructs an object in allocated, but not initialized storage pointed to by p the provided constructor arguments. If the object is of type that itself uses allocators, or if it is std::pair, passes *this down to the constructed object.

# Declarations

template< class U, class... Args >
void construct( U* p, Args&&... args );

(since C++17)

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 );

(since C++17) (until C++20)

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

(since C++17) (until C++20)

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

(since C++17) (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 );

(since C++17) (until C++20)

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

(since C++17) (until C++20)

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

(since C++17) (until C++20)

# Parameters

# Return value

(none)

# Notes

This function is called (through std::allocator_traits) by any allocator-aware object, such as std::pmr::vector (or another std::vector that was given a std::pmr::polymorphic_allocator as the allocator to use).

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 2969C++17uses-allocator construction passed resource()passes *this
LWG 2975C++17first overload is mistakenly used for pair construction in some casesconstrained to not accept pairs
LWG 3525C++17no overload could handle non-pair types convertible to pairreconstructing overload added

# See also