Is there a way to get a pair having both the lower_bound and upper_bound in a sorted array?

Viewed 60

If I have a std::vector having elements {1,1,1,2,2,2,3,3,3}

Is there a way to get a pair containing the lower_bound and upper_bound for value = 2 ?

Instead of me calling std::lower_bound and std::upper_bound separately.

2 Answers
Related