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;
精彩评论