std::tuple<char,int,bool>mytuple(){char a ='a';int i =123;bool b =true;return std::make_tuple(a, i, b);}automytuple1(){char a ='a';int i =123;bool b =true;return std::tuple(a, i, b);// No types needed}
<1> c++17 替换 c++ 11 写法
//std::tuple<char, int, bool>nn = mytuple();
//std::get<0>(nn);
auto [a, i, b] = mytuple();
std::map<char,int> mymap;
<2> c++17 替换 c++ 11 写法
//mymap.insert(make_pair('a', 100));
auto [itelem, success] = mymap.insert(std::pair('a', 100));
if (success) {
std::cout<<"insert success;"<<std::endl;
}
结构化绑定返回复合对象std::tuple<char, int, bool> mytuple(){ char a = 'a'; int i = 123; bool b = true; return std::make_tuple(a, i, b);}auto mytuple1(){ char a = 'a'; int i = 123; bool b = true; return std::tuple(a, i, b)