|
@@ -197,6 +197,20 @@ public:
|
|
|
swap(key_equals_, other.key_equals_);
|
|
swap(key_equals_, other.key_equals_);
|
|
|
}
|
|
}
|
|
|
friend void swap(bucket_hash_map & lhs, bucket_hash_map & rhs) { lhs.swap(rhs); }
|
|
friend void swap(bucket_hash_map & lhs, bucket_hash_map & rhs) { lhs.swap(rhs); }
|
|
|
|
|
+ friend bool operator==(bucket_hash_map const & lhs, bucket_hash_map const & rhs) {
|
|
|
|
|
+ if (lhs.size() != rhs.size()) { return false; }
|
|
|
|
|
+ auto end = rhs.end();
|
|
|
|
|
+ for (auto & pair : lhs) {
|
|
|
|
|
+ auto it = rhs.find(pair.first);
|
|
|
|
|
+ if (it == end || it->second != pair.second) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ friend bool operator!=(bucket_hash_map const & lhs, bucket_hash_map const & rhs) {
|
|
|
|
|
+ return !(lhs == rhs);
|
|
|
|
|
+ }
|
|
|
private:
|
|
private:
|
|
|
void maybe_expand(size_type add) {
|
|
void maybe_expand(size_type add) {
|
|
|
if ( static_cast<float>(size() + add) / bucket_count() > max_load_factor() ) {
|
|
if ( static_cast<float>(size() + add) / bucket_count() > max_load_factor() ) {
|