From 587479c28e1af7ddd1f7d3a5a1cea051cf66a77a Mon Sep 17 00:00:00 2001 From: Igor Zarzycki Date: Tue, 17 Sep 2024 12:53:15 +0200 Subject: [PATCH] Make bitWidth function acting on values uniformly callable. --- include/crap/bit.d/bitwidthvalue.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/crap/bit.d/bitwidthvalue.h b/include/crap/bit.d/bitwidthvalue.h index 0e0e5f7..d1e4d65 100644 --- a/include/crap/bit.d/bitwidthvalue.h +++ b/include/crap/bit.d/bitwidthvalue.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 @@ -49,6 +50,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 } @@ -61,6 +65,15 @@ typename crap :: bitWidthValue :: value_type () const noexcept { return crap :: bitWidthValue :: value; } +#if (crap_lib_integral_constant_callable >= 201304L) + +template +inline constexpr typename crap :: bitWidthValue :: value_type +crap :: bitWidthValue :: operator () () const noexcept +{ + return crap :: bitWidthValue :: value; +} +#endif #endif #endif