map/multi_fixed: add erase_item

This commit is contained in:
Danny Robson 2021-02-09 09:39:36 +10:00
parent de54f4b9e0
commit 2d47875b44

View File

@ -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&);