std::uses_allocator_construction_args
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   定义于头文件  <memory>
  | 
||
 T 不是 std::pair 的特化 | 
||
|   template< class T, class Alloc, class... Args > constexpr std::tuple</*see below*/> uses_allocator_construction_args(  | 
(1) | (C++20 起) | 
 T 是 std::pair 的特化 | 
||
|   template< class T, class Alloc, class Tuple1, class Tuple2 > constexpr std::tuple</*see below*/> uses_allocator_construction_args(  | 
(2) | (C++20 起) | 
|   template< class T, class Alloc > constexpr std::tuple</*see below*/> uses_allocator_construction_args(  | 
(3) | (C++20 起) | 
|   template< class T, class Alloc, class U, class V > constexpr std::tuple</*see below*/> uses_allocator_construction_args(  | 
(4) | (C++20 起) | 
|   template< class T, class Alloc, class U, class V > constexpr std::tuple</*see below*/> uses_allocator_construction_args(  | 
(5) | (C++20 起) | 
|   template< class T, class Alloc, class U, class V > constexpr std::tuple</*see below*/> uses_allocator_construction_args(  | 
(6) | (C++20 起) | 
准备以使用分配器构造的手段创建给定类型 T 对象所需的参数列表。
1) 此重载仅若 
T 不是 std::pair 的特化才参与重载决议。返回按下列方式确定的 std::tuple :
-  若 std::uses_allocator_v<T, Alloc> 为 
false而 std::is_constructible_v<T, Args...> 为true,则返回 std::forward_as_tuple(std::forward<Args>(args)...) -  否则,若 std::uses_allocator_v<T, Alloc> 为 
true而 std::is_constructible_v<T, std::allocator_arg_t, const Alloc&, Args...> 为true,则返回 std::tuple<std::allocator_arg_t, const Alloc&, Args&&...>(std::allocator_arg, alloc, std::forward<Args>(args)...) -  否则,若 std::uses_allocator_v<T, Alloc> 为 
true而 std::is_constructible_v<T, Args..., const Alloc&> 为true,则返回 std::forward_as_tuple(std::forward<Args>(args)..., alloc) - 否则,程序为谬构
 
2) 此重载仅若 
T 是 std::pair 的特化才参与重载决议。对于 T = std::pair<T1, T2> ,等价于
return std::make_tuple( std::piecewise_construct, std::apply( [&alloc](auto&&... args1) { return std::uses_allocator_construction_args<T1>( alloc, std::forward<decltype(args1)>(args1)...); }, std::forward<Tuple1>(x)), std::apply( [&alloc](auto&&... args2) { return std::uses_allocator_construction_args<T2>( alloc, std::forward<decltype(args2)>(args2)...); }, std::forward<Tuple2>(y)) );
3) 此重载仅若 
T 是 std::pair 的特化才参与重载决议。等价于
return std::uses_allocator_construction_args<T>(alloc, std::piecewise_construct, std::tuple<>{}, std::tuple<>{} );
4) 此重载仅若 
T 是 std::pair 的特化才参与重载决议。等价于
return std::uses_allocator_construction_args<T>( alloc, std::piecewise_construct, std::forward_as_tuple(std::forward<U>(u)), std::forward_as_tuple(std::forward<V>(v)) );
5) 此重载仅若 
T 是 std::pair 的特化才参与重载决议。等价于
return std::uses_allocator_construction_args<T>( alloc, std::piecewise_construct, std::forward_as_tuple(pr.first), std::forward_as_tuple(pr.second) );
6) 此重载仅若 
T 是 std::pair 的特化才参与重载决议。等价于
return std::uses_allocator_construction_args<T>( alloc, std::piecewise_construct, std::forward_as_tuple(std::move(pr).first), std::forward_as_tuple(std::move(pr).second));
参数
| alloc | - | 使用的分配器。 | 
| args | - |  传递给 T 构造函数的参数。
 | 
| x | - |  传递给 T 的 .first 的构造函数的参数 tuple 。
 | 
| y | - |  传递给 T 的 .second 的构造函数的参数 tuple 。
 | 
| u | - |  传递给 T 的 .first 的构造函数的单个参数。
 | 
| v | - |  传递给 T 的 .second 的构造函数的单个参数。
 | 
| pr | - |  pair ,将其 .first 传递给 T 的 .first 的构造函数,并将其 .second 传递给 T 的 .second 的构造函数的
 | 
返回值
适合于传递给 T 构造函数的参数的 std::tuple 。
示例
| 本节未完成 原因:暂无示例  | 
注解
重载 (2-6) 提供传入 std::pair 的分配器传播,它们不支持前导分配器或尾随分配器约定(不同于如使用前导分配器约定的 std::tuple )。
参阅
|    (C++11)  | 
   检查指定的类型是否支持使用分配器的构造   (类模板)  | 
|    (C++20)  | 
   以使用分配器构造的手段创建给类型的对象   (函数模板)  | 
|    以使用分配器构造的手段在指定的内存位置创建给定类型的对象   (函数模板)  |