I need a binary search function.
I couldn\'t find any function in the standard library that will return the index of the found item, and if it wasn\'t found,
Clearly, this "will return the bitwise complement" is a big deal for you and I do not understand what you mean. That said, lookup std::upper_bound and see if it does what you want.