void debug_buckets(HT const& hashtable) { std::multimap<size_t, MyClass const*> debug_map; std::transform(hashtable.begin(), hashtable.end(), std::inserter(debug_map, debug_map.end()), [&](MyClass const& mc) { return std::make_pair(hashtable.bucket(mc), &mc); } ); std::cout << "\nDebugging buckets of hashtable\n"; for (auto& entry : debug_map) std::cout << "Debug bucket: " << entry.first << " -> " << *entry.second << "\n"; }