From 6f8c024c3edecf644b506f632bd0706c8c6b5bd6 Mon Sep 17 00:00:00 2001 From: Igor Zarzycki Date: Tue, 17 Sep 2024 15:51:35 +0200 Subject: [PATCH] Make popcount function acting on values uniformly callable. --- include/crap/bit.d/popcountvalue.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/crap/bit.d/popcountvalue.h b/include/crap/bit.d/popcountvalue.h index 6bdff42..dd414de 100644 --- a/include/crap/bit.d/popcountvalue.h +++ b/include/crap/bit.d/popcountvalue.h @@ -15,6 +15,7 @@ #include "../numbers.d/zero.h" #include "../numeric.d/iotavalue.h" #include "../version.d/char8t.h" +#include "../version.d/libintegralconstantcallable.h" #include "../version.d/unicodecharacters.h" #endif @@ -50,6 +51,9 @@ namespace crap constexpr const static std :: size_t value = iotaValue :: template type :: value; using value_type = decltype(value); constexpr operator value_type () const noexcept; +#if (crap_lib_integral_constant_callable >= 201304L) + constexpr value_type operator () () const noexcept; +#endif }; #endif } @@ -62,6 +66,15 @@ typename crap :: popcountValue :: value_type () const noexcept { return crap :: popcountValue :: value; } +#if (crap_lib_integral_constant_callable >= 201304L) + +template +inline constexpr typename crap :: popcountValue :: value_type +crap :: popcountValue :: operator () () const noexcept +{ + return crap :: popcountValue :: value; +} +#endif #endif #endif