std::uses_allocator_construction_args
Header: <memory>
Prepares the argument list needed to create an object of the given type T by means of uses-allocator construction.
# Declarations
T is not a specialization of std::pair
template< class T, class Alloc, class... Args >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
Args&&... args ) noexcept;
(since C++20)
T is a specialization of std::pair
template< class T, class Alloc, class Tuple1, class Tuple2 >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
std::piecewise_construct_t, Tuple1&& x, Tuple2&& y ) noexcept;
(since C++20)
template< class T, class Alloc >
constexpr auto uses_allocator_construction_args( const Alloc& alloc ) noexcept;
(since C++20)
template< class T, class Alloc, class U, class V >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
U&& u, V&& v ) noexcept;
(since C++20)
template< class T, class Alloc, class U, class V >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
std::pair<U, V>& pr ) noexcept;
(since C++23)
template< class T, class Alloc, class U, class V >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
const std::pair<U, V>& pr ) noexcept;
(since C++20)
template< class T, class Alloc, class U, class V >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
std::pair<U, V>&& pr ) noexcept;
(since C++20)
template< class T, class Alloc, class U, class V >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
const std::pair<U, V>&& pr ) noexcept;
(since C++23)
template< class T, class Alloc, class NonPair >
constexpr auto uses_allocator_construction_args( const Alloc& alloc,
NonPair&& non_pair ) noexcept;
(since C++20)
# Parameters
alloc: the allocator to useargs: the arguments to pass to T’s constructorx: tuple of arguments to pass to the constructors of T’s first data membery: tuple of arguments to pass to the constructors of T’s second data memberu: single argument to pass to the constructor of T’s first data memberv: single argument to pass to the constructor of T’s second data memberpr: a pair whose first data member will be passed to the constructor of T’s first data member and second data member will be passed to the constructor of T’s second data membernon_pair: single argument to convert to a std::pair for further construction
# Return value
std::tuple of arguments suitable for passing to the constructor of T.
# Notes
The overloads (2-9) provide allocator propagation into std::pair, which supports neither leading-allocator nor trailing-allocator calling conventions (unlike, e.g. std::tuple, which uses leading-allocator convention).
When used in uses-allocator construction, the conversion function of pair-constructor converts the provided argument to std::pair at first, and then constructs the result from that std::pair by uses-allocator construction.
# Example
This section is incompleteReason: no example
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3525 | C++20 | no overload could handle non-pair types convertible to pair | reconstructing overload added |