From 6a70f0c501673d74d82ee07e0f8a75a8653656d1 Mon Sep 17 00:00:00 2001 From: Redstone1024 <2824517378@qq.com> Date: Tue, 14 Jan 2025 22:19:12 +0800 Subject: [PATCH] fix(strings): fix treating boolean type as integral arguments --- .../Source/Public/Strings/Formatting.h | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Strings/Formatting.h b/Redcraft.Utility/Source/Public/Strings/Formatting.h index c99f025..444c6c1 100644 --- a/Redcraft.Utility/Source/Public/Strings/Formatting.h +++ b/Redcraft.Utility/Source/Public/Strings/Formatting.h @@ -812,7 +812,9 @@ public: { MinDynamicField = Context.Visit([](U&& Value) -> size_t { - if constexpr (CIntegral>) + using FDecayU = TRemoveCVRef; + + if constexpr (CIntegral && !CSameAs) { checkf(Value > 0, TEXT("Illegal format argument. The dynamic width argument must be a unsigned non-zero number.")); @@ -833,7 +835,9 @@ public: { MaxDynamicField = Context.Visit([](U&& Value) -> size_t { - if constexpr (CIntegral>) + using FDecayU = TRemoveCVRef; + + if constexpr (CIntegral && !CSameAs) { checkf(Value > 0, TEXT("Illegal format argument. The dynamic precision argument must be a unsigned non-zero number.")); @@ -1641,7 +1645,9 @@ public: { TargetField = Context.Visit([](U&& Value) -> size_t { - if constexpr (CIntegral>) + using FDecayU = TRemoveCVRef; + + if constexpr (CIntegral && !CSameAs) { checkf(Value > 0, TEXT("Illegal format argument. The dynamic width argument must be a unsigned non-zero number.")); @@ -1662,7 +1668,9 @@ public: { TargetBase = Context.Visit([](U&& Value) -> size_t { - if constexpr (CIntegral>) + using FDecayU = TRemoveCVRef; + + if constexpr (CIntegral && !CSameAs) { checkf(Math::IsWithinInclusive(Value, 2, 36), TEXT("Illegal format argument. The dynamic base argument must be in the range [2, 36].")); @@ -2444,7 +2452,9 @@ public: { TargetField = Context.Visit([](U&& Value) -> size_t { - if constexpr (CIntegral>) + using FDecayU = TRemoveCVRef; + + if constexpr (CIntegral && !CSameAs) { checkf(Value > 0, TEXT("Illegal format argument. The dynamic width argument must be a unsigned non-zero number.")); @@ -2465,7 +2475,9 @@ public: { TargetPrecision = Context.Visit([](U&& Value) -> size_t { - if constexpr (CIntegral>) + using FDecayU = TRemoveCVRef; + + if constexpr (CIntegral && !CSameAs) { checkf(Value >= 0, TEXT("Illegal format argument. The dynamic precision argument must be a unsigned number.")); @@ -3030,7 +3042,9 @@ public: { TargetField = Context.Visit([](U&& Value) -> size_t { - if constexpr (CIntegral>) + using FDecayU = TRemoveCVRef; + + if constexpr (CIntegral && !CSameAs) { checkf(Value > 0, TEXT("Illegal format argument. The dynamic width argument must be a unsigned non-zero number."));