#include <iostream>
#include <iomanip>
#include <string>
#include <unordered_map>

int main ()
{
  std::unordered_map<std::string,int> m = {
    {"Belgium", 32},
    {"Canada", 1},
    {"France", 33},
    {"Germany", 49},
    {"United Kingdom", 44},
    {"United States", 1}
  };

  std::cout << "Max bucket count: "<< m.max_bucket_count() << std::endl; 
  std::cout << "Bucket count: " << m.bucket_count() <<std::endl; 
  for (int i=0; i < m.bucket_count(); i++ ) {
  	std::cout <<"   bucket "<< i << " : size " << m.bucket_size(i) << std::endl;
  }
  std::cout<<"Average bucket load:" <<m.load_factor()<<std::endl; 
 
  std::cout << "Container content: " <<std::endl;
  for (auto& x: m) {
    std::cout <<"\t"<< std::setw(20) << x.first << " -> " << x.second 
              << "\tBucket " << m.bucket (x.first) 
              << "\tAddress: "<< (void*)&x << std::endl;
  }
  
  m.rehash (2*m.bucket_count() );
  std::cout << "Bucket count after rehash: " << m.bucket_count() <<std::endl; 
  for (int i=0; i < m.bucket_count(); i++ ) {
  	std::cout <<"   bucket "<< i << " : size " << m.bucket_size(i) << std::endl;
  }
  std::cout<<"Average bucket load:" <<m.load_factor()<<std::endl; 
 

  return 0;
}