Remove AZStd::to_string(string&, bool) overload from MCore's StringConversion header

This overload has significant impact on overload resolution. Consider these
overloads:

```cpp
void to_string(AZStd::string& dest, AZStd::wstring_view src);
void to_string(string& str, bool value);
```

And then calling code like this:
```
WCHAR src[260];
AZStd::string dst;
AZStd::to_string(dst, src); // Which overload does this call?
```

If the .cpp has not included `MCore/Source/StringConversions.h`, the call
to `to_string()` will convert the `WCHAR[260]` type to a
`AZStd::wstring_view`, and call the first overload. But if
`StringConversions.h` _has_ been included, the implicit conversion of
`WCHAR[260]` to `bool` has a higher precedence, and it will be chosen
instead.

This overload was causing some uses of `to_string` in
`AnimGraph/GameController.cpp` to resolve to the wrong overload in unity
builds.

Signed-off-by: Chris Burel <burelc@amazon.com>
This commit is contained in:
Chris Burel
2022-02-10 13:24:27 -08:00
parent d4eb310950
commit 3d0a15f009
2 changed files with 0 additions and 7 deletions
@@ -76,11 +76,6 @@ namespace MCore
namespace AZStd
{
void to_string(string& str, bool value)
{
str = value ? "true" : "false";
}
void to_string(string& str, const AZ::Vector2& value)
{
str = AZStd::string::format("%.8f,%.8f",
@@ -49,7 +49,6 @@ namespace MCore
namespace AZStd
{
void to_string(string& str, bool value);
void to_string(string& str, const AZ::Vector2& value);
void to_string(string& str, const AZ::Vector3& value);
void to_string(string& str, const AZ::Vector4& value);
@@ -57,7 +56,6 @@ namespace AZStd
void to_string(string& str, const AZ::Matrix4x4& value);
void to_string(string& str, const AZ::Transform& value);
inline AZStd::string to_string(bool val) { AZStd::string str; to_string(str, val); return str; }
inline AZStd::string to_string(const AZ::Vector2& val) { AZStd::string str; to_string(str, val); return str; }
inline AZStd::string to_string(const AZ::Vector3& val) { AZStd::string str; to_string(str, val); return str; }
inline AZStd::string to_string(const AZ::Vector4& val) { AZStd::string str; to_string(str, val); return str; }