fork download
  1. #include <iostream>
  2. #include <set>
  3.  
  4. int main ()
  5. {
  6. std::set<int> myset = {1, 2, 3, 4}; // myset: 1 2 3 4
  7.  
  8. std::pair<std::set<int>::const_iterator,std::set<int>::const_iterator> range = myset.equal_range(2);
  9.  
  10. std::cout << "The range is from " << *range.first << " to " << *range.second << std::endl;
  11.  
  12. return 0;
  13. }
Success #stdin #stdout 0s 4308KB
stdin
Standard input is empty
stdout
The range is from 2 to 3