1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:07:46 +00:00

AK: Move String::number entirely to header file

Use SFINAE to enforce the fact that it's supposed to only be called for
Arithmetic types, rather than counting on the linker to tell us that an
instantiation of String::number(my_arg) was not found. This also adds
String::number for floating point types as a side-effect.
This commit is contained in:
Andrew Kaster 2020-12-29 22:46:52 -07:00 committed by Andreas Kling
parent b4eb734204
commit 0c51778510
2 changed files with 2 additions and 17 deletions

View file

@ -252,8 +252,8 @@ public:
return vformatted(fmtstr, VariadicFormatParams { parameters... });
}
template<typename T>
static String number(T);
template<typename T, typename EnableIf<IsArithmetic<T>::value>::Type* = nullptr>
static String number(T value) { return formatted("{}", value); }
StringView view() const;