From f4155cf0f4584cfda8c26d5e4dc5c0d2c3afb2c6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 26 Jul 2023 13:42:31 +0100 Subject: std::count is constexpr these days --- icespider/core/util.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/icespider/core/util.h b/icespider/core/util.h index 06ccbcc..f4d559b 100644 --- a/icespider/core/util.h +++ b/icespider/core/util.h @@ -70,12 +70,7 @@ template struct type_names { static constexpr auto namespaces() { - auto ns {0U}; - for (const auto & c : name()) { - // cppcheck-suppress useStlAlgorithm; (not constexpr) - ns += (c == ':') ? 1 : 0; - } - return ns / 2; + return std::count(name().begin(), name().end(), ':') / 2; } using char_type = typename decltype(name())::value_type; -- cgit v1.2.3