ClientList: use class boost::intrusive::list

Eliminate extra allocations for the std::list node instances.
This commit is contained in:
Max Kellermann
2014-06-10 18:57:30 +02:00
parent 0801b3f495
commit 3364c1b893
4 changed files with 25 additions and 29 deletions

View File

@@ -28,28 +28,15 @@
void
ClientList::Remove(Client &client)
{
assert(size > 0);
assert(!list.empty());
auto i = std::find(list.begin(), list.end(), &client);
assert(i != list.end());
list.erase(i);
--size;
list.erase(list.iterator_to(client));
}
void
ClientList::CloseAll()
{
while (!list.empty()) {
delete list.front();
list.pop_front();
#ifndef NDEBUG
--size;
#endif
}
assert(size == 0);
list.clear_and_dispose(Client::Disposer());
}
void
@@ -57,6 +44,6 @@ ClientList::IdleAdd(unsigned flags)
{
assert(flags != 0);
for (const auto &client : list)
client->IdleAdd(flags);
for (auto &client : list)
client.IdleAdd(flags);
}