16
0
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:
docentYT
2026-05-03 15:49:29 +02:00
parent 1e8b3d554a
commit 13c7317f6e
11 changed files with 60 additions and 59 deletions

View File

@@ -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");
}