mirror of
https://github.com/NixOS/nix
synced 2025-06-30 03:23:16 +02:00
refactor(libfetchers/registry): use standard remove_if + erase
Get rid of this fixme. This does not appear to be used anywhere in the nix codebase itself. Not sure why the comment mentioned C++20 erase member function with predicate, but iterator-based algorithms are also fine.
This commit is contained in:
parent
feb46688a2
commit
09ddc34b62
1 changed files with 3 additions and 6 deletions
|
@ -94,12 +94,9 @@ void Registry::add(
|
|||
|
||||
void Registry::remove(const Input & input)
|
||||
{
|
||||
// FIXME: use C++20 std::erase.
|
||||
for (auto i = entries.begin(); i != entries.end(); )
|
||||
if (i->from == input)
|
||||
i = entries.erase(i);
|
||||
else
|
||||
++i;
|
||||
entries.erase(
|
||||
std::remove_if(entries.begin(), entries.end(), [&](const Entry & entry) { return entry.from == input; }),
|
||||
entries.end());
|
||||
}
|
||||
|
||||
static Path getSystemRegistryPath()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue