This effort started when I wanted a method that did the following:
Given a BitVector and indices N and M, find the largest index less than M but greater than or equal to N which contains a set bit.
At first I just used find_prev(M) which I had added in an earlier patch, but I quickly discovered the performance of this was poor. My BitVector had over 500,000 bits in it, and in the worst case this could cause an O(n) scan all the way to the beginning. But I already had a lower bound on the range I wanted to search in, so I figured I could just make a function find_last_in(LowerBound, PriorTo).
But it quickly became apparent that if we already have this function, then find_last() is just find_last_in(0, Size) and find_prev(PriorTo) is just find_last_in(0, PriorTo).
In fact, all of the methods are generalizable this way. For example, find_first and find_next reduce to find_first_in(0, Size) and find_first_in(After, Size). The generalizations to the find_xxx_unset family of methods is obvious.
So I went all the way. There is now a find_in method for all combinations of [first, last] x [set, unset], and all find methods delegate to these methods.
Given that we return an int, I would prefer that the arguments also be int (and the intermediate variables within).