문제

I was wondering if it is possible to write a std::tie()-like function (using template programming) that can bind select components of a tuple only, and bind others to some placeholders like those in std::bind(). If so, one needs only declare variables for the parts he/she is interested in.

For example,

std::tie(x,_1,y,_2) = (2,3,4,5);
도움이 되었습니까?

해결책

Are you looking for std::ignore?

i.e.:

std::tie(x,std::ignore,y,std::ignore) = std::make_tuple(2,3,4,5);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top