Created
September 15, 2018 06:24
-
-
Save mochow13/97ed57601eb96f6b3640bf2445ea23bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sorted collection | |
std::vector<int> collection={1,2,5,5,5,6,9,12}; | |
// we are looking for a range where all elements equal to 5 | |
auto range = std::equal_range(begin(collection), end(collection), 5); | |
// the required range | |
std::cout<<(range.first-begin(collection))<<" "<<(range.second-begin(collection))<<std::endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment