get first element of tuple c++ code example
Example: get first element of tuple c++
#include
#include
#include
auto t = std::make_tuple(1, "Foo", 3.14);
// index-based access
std::cout << "(" << std::get<0>(t) << ", " << std::get<1>(t)<< ", " << std::get<2>(t) << ")\n";
// type-based access (C++14 or later)
std::cout << "(" << std::get(t) << ", " << std::get(t) << ", " << std::get(t) << ")\n";