map/multi_fixed: add erase_item
This commit is contained in:
parent
de54f4b9e0
commit
2d47875b44
@ -261,6 +261,23 @@ namespace cruft::map {
|
||||
return tally;
|
||||
}
|
||||
|
||||
void
|
||||
erase_item (value_type const &kv)
|
||||
{
|
||||
auto [first, last] = equal_range (kv.first);
|
||||
|
||||
auto const pos = std::find_if (
|
||||
first,
|
||||
last,
|
||||
[&kv] (auto const &candidate) { return candidate.second == kv.second; }
|
||||
);
|
||||
|
||||
if (pos == last)
|
||||
throw std::out_of_range ("unknown key-value");
|
||||
|
||||
erase (pos);
|
||||
}
|
||||
|
||||
|
||||
std::size_t erase (key_type const&);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user