#include #include using namespace std ; /* Example showing the expansion of a function that prints just a single element. */ template bool print_single_element( tupleType& tupleObject ) { cout << get< index1 > (tupleObject) << ", "; return true ; } template< typename... argTypes > void processFunction( argTypes... args ) { } template void unpack_helper(const Tuple& t, index_sequence object1 ) { processFunction( print_single_element( t ) ... ); } template void unpack_and_print( const Tuple& tupleObject ) { // Generate indices based on the size of the tuple constexpr auto size = tuple_size_v ; //creates a sort of list of numbers up to the size of the tuple //auto indexSequenceObject1 = make_index_sequence{} ; //index_sequence unpack_helper( tupleObject, make_index_sequence{} ) ; } int main() { // auto my_tuple = make_tuple(1, 3.14, 'A') ; tuple my_tuple = make_tuple(1, 3.14, 'A') ; //We want to print all the elements of the tuple //but we don't know how many elements are in our tuple const size_t sizeOfMyTuple = tuple_size_v< decltype(my_tuple) > ; //cout << get<0>(my_tuple) << endl ; //cout << get<1>(my_tuple) << endl ; //However if we don't know the size // beforehand we cannot just run a for loop //We need a compile time constant /* for( int i1=0 ; i1 < sizeOfMyTuple ; i1++ ) { cout << get(my_tuple) << endl ; } //for */ unpack_and_print( my_tuple ) ; return 0; }