C++ std__get(std__tuple)

https://en.cppreference.com/w/cpp/utility/tuple/get
the type T in std::get must occur exactly once in the tuple.

cpp 复制代码
#include <iostream>
#include <string>
#include <tuple>

int main()
{
    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), the type T in std::get<T> must occur exactly once in the tuple
    std::cout << "(" << std::get<int>(t) << ", " << std::get<const char*>(t)
        << ", " << std::get<double>(t) << ")\n";
    // Note: std::tie and structured binding may also be used to decompose a tuple
}
相关推荐
JetComXCpp1 小时前
给 Win32 窗口加上毛玻璃效果——纯 D3D11 实现,零依赖
c++
ysa0510303 小时前
【板子】二分答案(最大最小?)
c++·笔记·算法·板子
stolentime3 小时前
SP8549 MAIN75 - BST again题解
c++·算法·二叉树·深度优先·图论·记忆化搜索·组合数学
ziguo11224 小时前
C/C++ 错误处理全解:从 errno 到 C++ 异常
linux·c语言·c++·windows·visual studio
stolentime4 小时前
AT_pakencamp_2020_day1_k Gcd of Sum题解
c++·算法
2601_956121974 小时前
map_计蒜客T1271 完美K倍子数组
c++·算法
王维同学5 小时前
IFEO Debugger、VerifierDlls 与 SilentProcessExit 配置
c++·windows·安全·注册表
小保CPP6 小时前
OpenCV C++计算多边形的最大内切圆
c++·人工智能·opencv·计算机视觉
lueluelue477 小时前
八股临时总结
c++
小保CPP7 小时前
OpenCV C++校正AI模型检测到的文本(OCR)
c++·人工智能·opencv·计算机视觉·ocr