diff --git a/include/stdalgo.h b/include/stdalgo.h index 9a1c29445..b68827d39 100644 --- a/include/stdalgo.h +++ b/include/stdalgo.h @@ -86,24 +86,6 @@ namespace stdalgo delete p; } - /** - * Remove an element from a container - * @param cont Container to remove the element from - * @param val Value of the element to look for and remove - * @return True if the element was found and removed, false otherwise - */ - template class Cont, typename T, typename Alloc> - inline bool erase(Cont& cont, const T& val) - { - const typename Cont::iterator it = std::find(cont.begin(), cont.end(), val); - if (it != cont.end()) - { - cont.erase(it); - return true; - } - return false; - } - /** * Check if an element with the given value is in a container. Equivalent to (std::find(cont.begin(), cont.end(), val) != cont.end()). * @param cont Container to find the element in diff --git a/modules/dccallow.cpp b/modules/dccallow.cpp index 734fec6bc..02d53354f 100644 --- a/modules/dccallow.cpp +++ b/modules/dccallow.cpp @@ -406,7 +406,7 @@ public: // remove their DCCALLOW list if they have one if (udl) - stdalgo::erase(ul, user); + std::erase(ul, user); // remove them from any DCCALLOW lists // they are currently on diff --git a/modules/helpmode.cpp b/modules/helpmode.cpp index 358cba400..a4103f730 100644 --- a/modules/helpmode.cpp +++ b/modules/helpmode.cpp @@ -41,7 +41,7 @@ public: if (change.adding) helpers.push_back(dest); else - stdalgo::erase(helpers, dest); + std::erase(helpers, dest); return true; } @@ -117,7 +117,7 @@ public: void OnUserQuit(User* user, const std::string& message, const std::string& opermessage) override { if (user->IsModeSet(helpop)) - stdalgo::erase(helpop.helpers, user); + std::erase(helpop.helpers, user); } void OnWhois(Whois::Context& whois) override diff --git a/modules/ircv3_batch.cpp b/modules/ircv3_batch.cpp index b3be91fcb..76e4074e7 100644 --- a/modules/ircv3_batch.cpp +++ b/modules/ircv3_batch.cpp @@ -175,7 +175,7 @@ public: } // erase() not swaperase because the reftag generation logic depends on the order of the elements - stdalgo::erase(active_batches, &batch); + std::erase(active_batches, &batch); delete batch.batchinfo; batch.batchinfo = nullptr; } diff --git a/modules/spanningtree/treeserver.cpp b/modules/spanningtree/treeserver.cpp index d8b9167aa..9136349a3 100644 --- a/modules/spanningtree/treeserver.cpp +++ b/modules/spanningtree/treeserver.cpp @@ -166,7 +166,7 @@ void TreeServer::FinishBurst() void TreeServer::SQuitChild(TreeServer* server, const std::string& reason, bool error) { - stdalgo::erase(Children, server); + std::erase(Children, server); if (IsRoot()) { diff --git a/src/modules.cpp b/src/modules.cpp index f4f8d2426..f8c589479 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -193,7 +193,7 @@ ServiceProvider::ServiceProvider(Module* Creator, const std::string& Name, Servi void ServiceProvider::DisableAutoRegister() { if ((ServerInstance) && (ServerInstance->Modules.NewServices)) - stdalgo::erase(*ServerInstance->Modules.NewServices, this); + std::erase(*ServerInstance->Modules.NewServices, this); } const char* ServiceProvider::GetTypeString() const @@ -227,7 +227,7 @@ bool ModuleManager::Attach(Implementation i, Module* mod) bool ModuleManager::Detach(Implementation i, Module* mod) { - return stdalgo::erase(EventHandlers[i], mod); + return std::erase(EventHandlers[i], mod); } void ModuleManager::Attach(const Implementation* i, Module* mod, size_t sz) diff --git a/src/users.cpp b/src/users.cpp index 3268e5b58..28b0109b5 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -342,7 +342,7 @@ Cullable::Result User::Cull() ServerInstance->Users.RemoveCloneCounts(this); if (server->IsService()) - stdalgo::erase(ServerInstance->Users.all_services, this); + std::erase(ServerInstance->Users.all_services, this); return Extensible::Cull(); } diff --git a/src/xline.cpp b/src/xline.cpp index 32a6fd1a8..6f95b0baa 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -357,7 +357,7 @@ bool XLineManager::DelLine(const std::string& hostmask, const std::string& type, y->second->Unset(); - stdalgo::erase(pending_lines, y->second); + std::erase(pending_lines, y->second); delete y->second; x->second.erase(y); @@ -456,7 +456,7 @@ void XLineManager::ExpireLine(ContainerIter container, LookupIter item, bool sil * is pending, cleared when it is no longer pending, so we skip over this loop if its not pending? * -- Brain */ - stdalgo::erase(pending_lines, item->second); + std::erase(pending_lines, item->second); delete item->second; container->second.erase(item);