mardi 3 octobre 2017

Binary Search for a tuple with a given element value in C++

I want to find all tuples in:

vector<tuple<int,int>> tuples; //already sorted

that evaluate the next proposition to "true":

(get<0>(tuple) == val)

I'm trying to use the equal_range function to get a range:

equal_range (tuples.begin(), tuples.end(), val);

How can I express "val" correctly for the value comparison to happen in the first element of the tuples?

Aucun commentaire:

Enregistrer un commentaire