Big update.

This commit is contained in:
UltraNix
2022-03-12 22:28:00 +01:00
parent 6006eeeb01
commit 12d41d1314
2064 changed files with 427245 additions and 268481 deletions

View File

@@ -90,71 +90,6 @@ namespace Acore::Impl::StringConvertImpl
}
};
#ifdef ACORE_NEED_CHARCONV_WORKAROUND
/*
If this is defined, std::from_chars will cause linkage errors for 64-bit types.
(This is a bug in clang-7.)
If the clang requirement is bumped to >= clang-8, remove this ifdef block and its
associated check in cmake/compiler/clang/settings.cmake
*/
template <>
struct For<uint64, void>
{
static Optional<uint64> FromString(std::string_view str, int base = 10)
{
if (str.empty())
{
return std::nullopt;
}
try
{
size_t n;
uint64 val = std::stoull(std::string(str), &n, base);
if (n != str.length())
{
return std::nullopt;
}
return val;
}
catch (...) { return std::nullopt; }
}
static std::string ToString(uint64 val)
{
return std::to_string(val);
}
};
template <>
struct For<int64, void>
{
static Optional<int64> FromString(std::string_view str, int base = 10)
{
try
{
if (str.empty())
{
return std::nullopt;
}
size_t n;
int64 val = std::stoll(std::string(str), &n, base);
if (n != str.length())
{
return std::nullopt;
}
return val;
}
catch (...) { return std::nullopt; }
}
static std::string ToString(int64 val)
{
return std::to_string(val);
}
};
#endif
template <>
struct For<bool, void>
{