thor
thor

Reputation: 22570

Is it to possible to extend std::tie in c++11 to accept place holders?

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);

Upvotes: 1

Views: 804

Answers (1)

user1508519
user1508519

Reputation:

Are you looking for std::ignore?

i.e.:

std::tie(x,std::ignore,y,std::ignore) = std::make_tuple(2,3,4,5);

Upvotes: 13

Related Questions