| 3309 | } |
| 3310 | |
| 3311 | size_type erase(const key_type& key) |
| 3312 | { |
| 3313 | size_type num_probes = 0; // how many times we've probed |
| 3314 | const size_type bucket_count_minus_one = bucket_count() - 1; |
| 3315 | size_type bucknum = hash(key) & bucket_count_minus_one; |
| 3316 | |
| 3317 | while (1) // probe until something happens |
| 3318 | { |
| 3319 | typename Table::GrpPos grp_pos(table, bucknum); |
| 3320 | |
| 3321 | if (!grp_pos.test_strict()) |
| 3322 | return 0; // bucket is empty, we deleted nothing |
| 3323 | if (grp_pos.test()) |
| 3324 | { |
| 3325 | reference ref(grp_pos.unsafe_get()); |
| 3326 | |
| 3327 | if (equals(key, get_key(ref))) |
| 3328 | { |
| 3329 | grp_pos.erase(table); |
| 3330 | ++num_deleted; |
| 3331 | settings.set_consider_shrink(true); // will think about shrink after next insert |
| 3332 | return 1; // because we deleted one thing |
| 3333 | } |
| 3334 | } |
| 3335 | ++num_probes; // we're doing another probe |
| 3336 | bucknum = (bucknum + JUMP_(key, num_probes)) & bucket_count_minus_one; |
| 3337 | assert(num_probes < bucket_count() |
| 3338 | && "Hashtable is full: an error in key_equal<> or hash<>"); |
| 3339 | } |
| 3340 | } |
| 3341 | |
| 3342 | const_iterator erase(const_iterator pos) |
| 3343 | { |
nothing calls this directly
no test coverage detected