I have a foo which is a std::vector<int>. It represents the "edge" values for a set of ranges.
For example, if foo is {1, 3, 5, 7, 11} then the ranges are 1-3, 3-5, 5-7, 7-11. Significantly for me, this equates to 4 periods. Note that each period includes the first number in a range, and not the last one. So in my example, 8 appears in the 3rd (zero-based) period. 7 also appears in the 3rd period. 11 and above doesn't appear anywhere. 2 appears in the 0th period.
Given a bar which is an int, I use
std::find_if(
foo.begin(),
foo.end(),
std::bind2nd(std::greater<int>(), bar)
) - foo().begin() - 1;
to give me the period that should contain bar.
My problem: std::bind2nd is deprecated so I ought to refactor. What is the equivalent statement using updated functions? std::bind doesn't "drop in" in the obvious way.