get
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
|
x |
Function
Extracts elements at specified positions from a tuple container.
Prototype
1 2 | template <size_t N, typename ...Tps> __aicore__ inline typename tuple_element<N, tuple<Tps...> >::type& get(tuple<Tps...>& t) noexcept |
1 2 | template <size_t N, typename ...Tps> __aicore__ inline const typename tuple_element<N, tuple<Tps...> >::type& get(const tuple<Tps...>& t) noexcept |
1 2 | template <size_t N, typename ...Tps> __aicore__ inline typename tuple_element<N, tuple<Tps...> >::type&& get(tuple<Tps...>&& t) noexcept |
1 2 | template <size_t N, typename ...Tps> __aicore__ inline const typename tuple_element<N, tuple<Tps...> >::type&& get(const tuple<Tps...>&& t) noexcept |
Parameters
Parameter |
Description |
|---|---|
N |
Constant during building, which indicates the index of the element to be extracted. The index starts from 0 and the value range is [0, 64). |
Tps... |
Template parameter package passed to the tuple. The number of tuple parameters is in the range of (0, 64]. For the For the |
t |
Tuple object, which can be a left-value reference, a constant left-value reference, or a right-value reference. |
Restrictions
The get function supports only the const and constexpr constant indexes. The index value range is [0, 64).
Returns
Element in the corresponding position in the tuple object
Example
1 2 | AscendC::Std::tuple<uint32_t, float, bool> test{11, 2.2, true}; uint32_t const_uint32_t = AscendC::Std::get<0>(test); |
For more examples, see Example.