开发者

Expanding an std::tuple

Let's say I 开发者_JAVA技巧have a C++0x tuple:

tuple<int,int,int> t(1,2,3);

Now I can do the following to extract the elements of t:

int i,j,k;
make_tuple<int&,int&,int&>(i,j,k) = t;

Is there any less verbose way of achieving this? I know about the get<0>(t) syntax; it is not what I am after.


You can use tie for that:

std::tie(i, j, k) = t;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜