Home How to print std::tuple iteratively
Reply: 0

How to print std::tuple iteratively

user510
1#
user510 Published in April 22, 2018, 6:16 pm

Most samples of c++ books leverage recursively mechanism to print std::tuple. Is it possible to print std::tuples iteratively by leverage sizeof...(Typename)?

For example, the function signature is like below:

template<typename... Ts> constexpr void PrintTuple(std::tuple<Ts...>& tuple)

Then I could use sizeof...(Ts) to know how many elements in the tuple and then I could use std::get< i >(tuple) to retrieve the individual element?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311876 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO