首页 > 试题广场 >

以下代码使用了std::apply(C++17),输出是什么

[单选题]
以下代码使用了std::apply(C++17),输出是什么?
#include <tuple>
#include <iostream>
int add(int a, int b, int c) { return a + b + c; }
int main() {
auto t = std::make_tuple(1, 2, 3);
std::cout << std::apply(add, t);
}
  • 6
  • 编译错误
  • 123
  • 未定义行为

这道题你会答吗?花几分钟告诉大家答案吧!