mirror of
https://github.com/NixOS/nix
synced 2025-06-30 07:33: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)
|
void Registry::remove(const Input & input)
|
||||||
{
|
{
|
||||||
// FIXME: use C++20 std::erase.
|
entries.erase(
|
||||||
for (auto i = entries.begin(); i != entries.end(); )
|
std::remove_if(entries.begin(), entries.end(), [&](const Entry & entry) { return entry.from == input; }),
|
||||||
if (i->from == input)
|
entries.end());
|
||||||
i = entries.erase(i);
|
|
||||||
else
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Path getSystemRegistryPath()
|
static Path getSystemRegistryPath()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue