C++17 structured binding 发表于 2023-08-13 使用C++17的结构化绑定可以根据一个函数的返回值同时定义多个变量,如下所示: 12345678910#include <iostream>#include <tuple>using namespace std;int main ( ) { tuple<string,int> student("Sriram", 10); auto [name, age] = student; cout << "\nName of the student is " << name << endl; cout << "Age of the student is " << age << endl; return 0;}