mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Replace stalgo::erase with C++20 std::erase.
This commit is contained in:
parent
ab31cf9d37
commit
5dd92c5388
@ -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 <template<typename, typename> class Cont, typename T, typename Alloc>
|
||||
inline bool erase(Cont<T, Alloc>& cont, const T& val)
|
||||
{
|
||||
const typename Cont<T, Alloc>::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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user