std::uses_allocator_construction_args_C++中文网
| 定义于头文件 |
||
|
|
||
| template< class T, class Alloc, class... Args > constexpr std::tuple</*see below*/> uses_allocator_construction_args( |
(1) | (C++20 起) |
|
|
||
| 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> ,等价于
3) 此重载仅若 T 是 std::pair 的特化才参与重载决议。等价于
4) 此重载仅若 T 是 std::pair 的特化才参与重载决议。等价于
5) 此重载仅若 T 是 std::pair 的特化才参与重载决议。等价于
6) 此重载仅若 T 是 std::pair 的特化才参与重载决议。等价于
参数
| 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 )。