fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <map>
  4. using namespace std;
  5.  
  6. int main() {
  7. const multimap<unsigned int, int> x = {{1U, 13}, {2U, 'a'}, {1U, 0}};
  8. auto it = x.cbegin();
  9.  
  10. while(it != x.cend()) {
  11. auto end = x.upper_bound(it->first);
  12.  
  13. cout << it->first << "\n\t";
  14. for_each(it, end, [](const auto& i){ cout << i.second << '\t'; });
  15. cout << endl;
  16. it = end;
  17. }
  18. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
1
	13	0	
2
	97