我擦,这还是当年的傻白甜CPP吗?

xiaoxiake   (xiaoxiake)2020-05-22 20:56:35
#include <iostream>
#include <string>
#include <tuple>
std::tuple<int, double, std::string> f() {
return std::make_tuple(1, 2.3, "456");
}
int main() {
[color=#DC143C]auto[x, y, z] = f(); // x,y,z 分别被推导为int,double,std::string[/color]
std::cout << x<< y<< z << std::endl;
}

水木社区