How to get the iterator for a successful binary_search?

24

I want to get the iterator for the element I'm testing for in binary-search. But it only returns a bool indicating whether it found the value or not. How to get the iterator?

nakiya

Posted 2010-11-22T05:28:23.763

Reputation: 6 243

Question was closed 2017-10-05T10:15:30.133

Answers

25

You want either lower_bound, upper_bound, or equal_range.

CTT

Posted 2010-11-22T05:28:23.763

Reputation: 11 905