| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 
 | // unordered_multiset::bucket_count
#include <iostream>
#include <string>
#include <unordered_set>
int main ()
{
  std::unordered_multiset<std::string> myums =
  {"Klingon","Vulcan","Klingon","Cardassian","Vulcan","Human"};
  unsigned n = myums.bucket_count();
  std::cout << "myums has " << n << " buckets.\n";
  for (unsigned i=0; i<n; ++i) {
    std::cout << "bucket #" << i << " contains:";
    for (auto it = myums.begin(i); it!=myums.end(i); ++it)
      std::cout << " " << *it;
    std::cout << "\n";
  }
  return 0;
}
 |  |