I'm trying to figure out the following problem.
Suppose I have the following container in C++:
std::set<std::pair<int, int> > my_container;
This set (dictionary) is sorted with respect to the order <
on std::pair<int, int>
, which is the lexicographic order. My task is to find any element in my_container
that has the first coordinate equal to, say x
, and return the iterator to it. Obviously, I don't want to use find_if
, because I need to solve this in logarithmic time.
I would appreciate any advice on how this can be done