From 8157678eba97d7de5c53b424a9866d327392bbd9 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 31 May 2021 12:27:58 -0700 Subject: Fix standard incompetence found by MSVC - requires-expression still not working, because they aren't supported yet outside of a concept --- core/src/Model/Workflow/Values/BasicValues.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'core/src/Model/Workflow/Values') diff --git a/core/src/Model/Workflow/Values/BasicValues.cpp b/core/src/Model/Workflow/Values/BasicValues.cpp index a7cf635..748c652 100644 --- a/core/src/Model/Workflow/Values/BasicValues.cpp +++ b/core/src/Model/Workflow/Values/BasicValues.cpp @@ -14,14 +14,13 @@ NumericValue::NumericValue() { } -template +template static std::string NumberToString(T value) { - constexpr auto kSize = std::numeric_limits::max_digits10; - char buf[kSize]; + char buf[kMaxSize]; #if PLATFORM_WIN32 - auto res = std::to_chars(buf, buf + kSize, value); + auto res = std::to_chars(buf, buf + kMaxSize, value); if (res.ec == std::errc()) { return std::string(buf, res.ptr); } else { @@ -35,17 +34,20 @@ static std::string NumberToString(T value) std::string NumericValue::GetTruncatedString() const { - return ::NumberToString((int64_t)mValue); + constexpr auto kMaxSize = std::numeric_limits::digits10; + return ::NumberToString((int64_t)mValue); } std::string NumericValue::GetRoundedString() const { - return ::NumberToString((int64_t)std::round(mValue)); + constexpr auto kMaxSize = std::numeric_limits::digits10; + return ::NumberToString((int64_t)std::round(mValue)); } std::string NumericValue::GetString() const { - return ::NumberToString(mValue); + constexpr auto kMaxSize = std::numeric_limits::max_digits10; + return ::NumberToString(mValue); } int64_t NumericValue::GetInt() const -- cgit v1.2.3-70-g09d2