std::tuple iterate code example
Example 1: iterator on std::tuple
#include <tuple>
#include <iostream>
int main()
{
std::tuple t{42, 'a', 4.2};
std::apply([](auto&&... args) {((std::cout << args << '\n'), ...);}, t);
}
Example 2: iterator on std::tuple
template <size_t ...I>
struct index_sequence {};
template <size_t N, size_t ...I>
struct make_index_sequence : public make_index_sequence<N - 1, N - 1, I...> {};
template <size_t ...I>
struct make_index_sequence<0, I...> : public index_sequence<I...> {};