make_tuple
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function
Creates tuple objects conveniently as a practical function template. make_tuple can automatically infer the element type to simplify the code and construct an element list.
Prototype
1 2 | template <typename ...Tps> __aicore__ inline constexpr tuple<unwrap_decay_t<Tps>...> make_tuple(Tps&& ...args) |
Parameters
Parameter |
Description |
|---|---|
Tps... |
Template parameter package passed to the tuple, indicating the type of parameters passed to make_tuple. The number of parameters ranges from 0 to 64. For the For the |
args |
Function parameter package, indicating the actual parameters passed to make_tuple. The number of parameters ranges from 0 to 64. |
Restrictions
- The tuple instantiation depth is 64, that is, aggregation of basic data types with a maximum of 64 elements is supported.
- Data types of the elements to be specified in make_tuple must be forcibly converted. Otherwise, the compiler infers the data types, which may be different from the expectation.
- Variable-length data types such as arrays are not supported.
- Implicit conversion constructors are not supported.
Returns
A tuple object that contains copies of the passed parameters
Example
1 | AscendC::Std::tuple<uint32_t, float, bool> test = AscendC::Std::make_tuple(22, 3.3, true); |
For more examples, see Example.