📌  相关文章
📜  获取元组 C++ 代码示例的第一个元素

📅  最后修改于: 2022-03-11 14:44:46.717000             🧑  作者: Mango

代码示例1
#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";