So If I have something like this
template<typename... Args >
class tuple_class
{
public:
std::tuple<Args...> tup;
/*I left out the other functions */
};
I want to overload the operator<< so that it will recursively print the tuple when called on the class.
ex.
auto a = tuple_class(1, 2 ,3);
std::cout << a << endl;
would hopefully print '123'
Ive seen other examples of tuple printers but I can't apply it to my class without having a bunch of trouble
I think I should start with a member function like this
template<typename... Args>
friend std::ostream& operator<<(std::ostream& os, const my_tuple<Args...> &m);
and then the actual function outside the class
template<typename... Args>
std::ostream& operator<<(std::ostream& os, const my_tuple<Args...> &m)
{
os << "SOMETHING" << std::endl;
return os;
}
That actually worked when I call the << operator on my class. But I have no clue how to make it actually print the tuple.
Any help would be appreciated