1

我想知道是否可以编写一个类似std::tie()- 的函数(使用模板编程),它只能绑定元组的选择组件,并将其他组件绑定到一些占位符,例如std::bind(). 如果是这样,只需要为他/她感兴趣的部分声明变量。

例如,

std::tie(x,_1,y,_2) = (2,3,4,5);
4

1 回答 1

13

你在找std::ignore吗?

IE:

std::tie(x,std::ignore,y,std::ignore) = std::make_tuple(2,3,4,5);
于 2014-01-23T03:35:01.077 回答