您的位置:首页 > 其它

stl中的tuple(tie)

2016-05-19 20:44 323 查看
看的C++标准库(第二版)

书中关于tie()介绍看不懂,不知道这玩意到底能干啥,自己试了一波

tuple <int, float, string> t(55, 22.2, "hello");

    int i,i1;

    float f,f1;

    string s,s1;

    make_tuple(ref(i), ref(f), ref(s)) = t;

    cout << "i = " << i << endl;

    cout << "f = " << f << endl;

    cout << "s = " << s << endl;

    tie(i1, f1, s1) = t;

    cout << "i1 = " << i1 << endl;
    cout << "f1 = " << f1 << endl;

    cout << "s1 = " << s1 << endl;



这就是说的提取?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: