0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::stats: Simplify f7945918c; eliminate sort.

This commit is contained in:
Jason Volk 2020-12-20 03:14:50 -08:00
parent 4d48be4aa6
commit 099c7754ff

View file

@ -115,17 +115,13 @@ ircd::stats::item<void>::item(const std::type_index &type,
NAME_MAX_LEN
};
static const auto less
{
[](const auto &a, const auto &b)
{
return a->name < b->name;
}
};
const auto exists
{
std::binary_search(begin(items), end(items), this, less)
end(items) != std::find_if(begin(items), end(items), [this]
(const auto &item)
{
return item->name == this->name;
})
};
if(unlikely(exists))
@ -139,7 +135,6 @@ ircd::stats::item<void>::item(const std::type_index &type,
items.reserve(4096);
items.emplace_back(this);
std::sort(begin(items), end(items), less);
}
ircd::stats::item<void>::~item()