Let's say I have
std::vector<std::tuple<string ,int ,int>> tupleVector;
tupleVector.push_back(std::tuple<string ,int ,int>("Joe", 2, 3));
tupleVector.push_back(std::tuple<string ,int ,int>("Bob", 4, 5));
How can I iterate on the vector to print all values of this vector containing a tuple?
Just iterate the vector
, printing each tuple
value using cout
:
for (const auto& i : tupleVector) {
cout << get<0>(i) << ", " << get<1>(i) << ", " << get<2>(i) << endl;
}