mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 19:19:19 +02:00
Do not allow implicit cast for inline std::string to_string(bool Value) and change to_string to std::string for non boolean values
This commit is contained in:
@@ -123,7 +123,8 @@ std::string to_string(double Value, int precision, int width);
|
||||
std::string to_hex_str(int const Value, int const width = 4);
|
||||
std::string to_minutes_str(float const Minutes, bool const Leadingzero, int const Width);
|
||||
|
||||
inline std::string to_string(bool Value)
|
||||
template <std::same_as<bool> T> // Without this line this function can be used with other types implicit casted to boolean which may create hard to debug bugs.
|
||||
inline std::string to_string(T Value)
|
||||
{
|
||||
return (Value == true ? "true" : "false");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user