diff --git a/src/utils/safe_convert.hpp b/src/utils/safe_convert.hpp index 5e9da14a261..9685cdd5e54 100644 --- a/src/utils/safe_convert.hpp +++ b/src/utils/safe_convert.hpp @@ -72,8 +72,8 @@ std::string number_to_string(U value) { * int integer = safe_convert("invalid", __FUNCTION__, -1); // Returns -1 */ template - requires std::is_arithmetic_v && !std::is_enum_v || !std::is_enum_v && std::is_same_v - T safe_convert(U value, std::string_view callerName = "Name not defined", T defaultValue = get_default_value()) { +requires (std::is_arithmetic_v && !std::is_enum_v) || (!std::is_enum_v && std::is_same_v) +T safe_convert(U value, std::string_view callerName = "Name not defined", T defaultValue = get_default_value()) { static_assert(std::is_arithmetic_v || std::is_same_v, "T must be an arithmetic type or string."); try { // Direct conversion if types are the same @@ -178,7 +178,7 @@ template * MyEnum e3 = safe_convert(10, "myFunction", MyEnum::C); // Returns MyEnum::C as default */ template - requires std::is_enum_v +requires std::is_enum_v T safe_convert(U value, std::string_view callerName = "Name not defined", T defaultValue = T()) { try { if constexpr (std::is_same_v) { @@ -211,7 +211,7 @@ T safe_convert(U value, std::string_view callerName = "Name not defined", T defa * unsigned int uval = safe_convert(MyEnum::X, "callerFunc", 0); */ template - requires std::is_enum_v && std::is_arithmetic_v +requires std::is_enum_v && std::is_arithmetic_v Target safe_convert(Source sourceValue, std::string_view callerName = "Name not defined", Target defaultValue = Target()) { try { if constexpr (std::is_same_v) {