std::uses_allocator_construction_args (3) - Linux Manuals
std::uses_allocator_construction_args: std::uses_allocator_construction_args
NAME
std::uses_allocator_construction_args - std::uses_allocator_construction_args
Synopsis
Defined in header <memory>
T is not a specialization of std::pair
template< class T, class Alloc, class... Args >
std::tuple</*see below*/> uses_allocator_construction_args( (1) (since C++20)
const Alloc& alloc, Args&&... args);
T is a specialization of std::pair
template< class T, class Alloc, class Tuple1, class Tuple2 >
std::tuple</*see below*/> uses_allocator_construction_args( (2) (since C++20)
const Alloc& alloc, std::piecewise_construct_t, Tuple1&& x, Tuple2&& y);
template< class T, class Alloc > (3) (since C++20)
std::tuple</*see below*/> uses_allocator_construction_args( const Alloc& alloc );
template< class T, class Alloc, class U, class V >
std::tuple</*see below*/> uses_allocator_construction_args( (4) (since C++20)
const Alloc& alloc, U&& u, V&& v);
template< class T, class Alloc, class U, class V >
std::tuple</*see below*/> uses_allocator_construction_args( (5) (since C++20)
const Alloc& alloc, const std::pair<U,V>& pr);
template< class T, class Alloc, class U, class V >
std::tuple</*see below*/> uses_allocator_construction_args( (6) (since C++20)
const Alloc& alloc, std::pair<U,V>&& pr);
Prepares the argument list needed to create an object of the given type T by means of uses-allocator_construction.
1) This overload only participates in overload resolution if T is not a specialization of std::pair. Returns std::tuple determined as follows:
* If std::uses_allocator_v<T, Alloc> is false and std::is_constructible_v<T, Args...> is true, returns std::forward_as_tuple(std::forward<Args>(args)...)
* Otherwise, if std::uses_allocator_v<T, Alloc> is true and std::is_constructible_v<T, std::allocator_arg_t, Alloc, Args...> is true, returns std::tuple<std::allocator_arg_t, const Alloc&, Args&&...>(std::allocator_arg, alloc, std::forward<Args>(args)...)
* Otherwise, if std::uses_allocator_v<T, Alloc> is true and std::is_constructible_v<T, Args..., Alloc> is true, returns std::forward_as_tuple(std::forward<Args>(args)..., alloc)
* Otherwise, the program is ill-formed
2) This overload only participates in overload resolution if T is a specialization of std::pair. For T = std::pair<T1, T2>, equivalent to
3) This overload only participates in overload resolution if T is a specialization of std::pair. Equivalent to
4) This overload only participates in overload resolution if T is a specialization of std::pair. Equivalent to
5) This overload only participates in overload resolution if T is a specialization of std::pair. Equivalent to
6) This overload only participates in overload resolution if T is a specialization of std::pair. Equivalent to
Parameters
alloc - the allocator to use.
args - the arguments to pass to T's constructor
x - tuple of arguments to pass to the constructors of T's .first
y - tuple of arguments to pass to the constructors of T's .second
u - single argument to pass to the constructor of T's .first
v - single argument to pass to the constructor of T's .second
pr - a pair whose .first will be passed to the constructor of T's .first and .second will be passed to the constructor of T's .second
Return value
std::tuple of arguments suitable for passing to the constructor of T
Example
This section is incomplete
Reason: no example
Notes
The overloads (2-6) 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)
See also
uses_allocator checks if the specified type supports uses-allocator construction
(C++11)
make_obj_using_allocator creates an object of the given type by means of uses-allocator construction
(C++20)
uninitialized_construct_using_allocator creates an object of the given type at specified memory location by means of uses-allocator construction