summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-07-26 13:42:31 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-07-26 13:42:31 +0100
commitf4155cf0f4584cfda8c26d5e4dc5c0d2c3afb2c6 (patch)
tree9c3d67a72c8dacd405ba38ebc187c09c6c82191c
parentSwap ifndef for pragma once (diff)
downloadicespider-f4155cf0f4584cfda8c26d5e4dc5c0d2c3afb2c6.tar.bz2
icespider-f4155cf0f4584cfda8c26d5e4dc5c0d2c3afb2c6.tar.xz
icespider-f4155cf0f4584cfda8c26d5e4dc5c0d2c3afb2c6.zip
std::count is constexpr these days
-rw-r--r--icespider/core/util.h7
1 files changed, 1 insertions, 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<typename T> 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;