Many STL algorithms use swap instead of copy constructors
| 2965 | |
| 2966 | // Many STL algorithms use swap instead of copy constructors |
| 2967 | void swap(sparse_hashtable& ht) |
| 2968 | { |
| 2969 | using std::swap; |
| 2970 | |
| 2971 | swap(settings, ht.settings); |
| 2972 | swap(key_info, ht.key_info); |
| 2973 | swap(num_deleted, ht.num_deleted); |
| 2974 | table.swap(ht.table); |
| 2975 | settings.reset_thresholds(bucket_count()); // also resets consider_shrink |
| 2976 | ht.settings.reset_thresholds(ht.bucket_count()); |
| 2977 | // we purposefully don't swap the allocator, which may not be swap-able |
| 2978 | } |
| 2979 | |
| 2980 | // It's always nice to be able to clear a table without deallocating it |
| 2981 | void clear() |
no test coverage detected