MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / swap

Method swap

libCacheSim/dataStructure/sparsepp/spp.h:2967–2978  ·  view source on GitHub ↗

Many STL algorithms use swap instead of copy constructors

Source from the content-addressed store, hash-verified

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()

Callers 2

sparse_hashtableMethod · 0.95
sparse_hashtableClass · 0.95

Calls 4

reset_thresholdsMethod · 0.80
swapFunction · 0.70
swapMethod · 0.45
bucket_countMethod · 0.45

Tested by

no test coverage detected