In this section, we will write a program that can print any tuple on the fly. In addition to that, we will write a function that can zip tuples together:
- We need to include a number of headers first and then we declare that we use the std namespace by default:
#include <iostream> #include <tuple> #include <list> #include <utility> #include <string> #include <iterator> #include <numeric> #include <algorithm> using namespace std;
- As we will be dealing with tuples, it will be interesting to display their content. Therefore, we will now implement a very generic function that can print any tuple that consists of printable types. The function accepts an output stream reference os, which will be used to do the actual printing, ...