From 099c7754ff9192263ae2af4263dfffb49f89d5d1 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 20 Dec 2020 03:14:50 -0800 Subject: [PATCH] ircd::stats: Simplify f7945918c; eliminate sort. --- ircd/stats.cc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ircd/stats.cc b/ircd/stats.cc index 9adc0b0e5..12022a978 100644 --- a/ircd/stats.cc +++ b/ircd/stats.cc @@ -115,17 +115,13 @@ ircd::stats::item::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::item(const std::type_index &type, items.reserve(4096); items.emplace_back(this); - std::sort(begin(items), end(items), less); } ircd::stats::item::~item()