Skip to content

Commit

Permalink
Strings: Allow using SmallString<N> as argument to format
Browse files Browse the repository at this point in the history
  • Loading branch information
Pagghiu committed Mar 3, 2024
1 parent 1ded627 commit 4efa35b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Libraries/Strings/StringFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ template <typename T>
struct Vector;
struct Console;
struct String;
template <int N>
struct SmallString;
template <typename T>
struct StringFormatterFor;

Expand Down Expand Up @@ -239,9 +241,11 @@ template <> struct StringFormatterFor<StringView> {static bool format(StringFo
template <> struct StringFormatterFor<String> {static bool format(StringFormatOutput&, const StringView, const String&);};
template <> struct StringFormatterFor<const char*> {static bool format(StringFormatOutput&, const StringView, const char*);};
#if SC_PLATFORM_WINDOWS
template <> struct StringFormatterFor<wchar_t> {static bool format(StringFormatOutput&, const StringView, const wchar_t);};
template <> struct StringFormatterFor<wchar_t> {static bool format(StringFormatOutput&, const StringView, const wchar_t);};
template <> struct StringFormatterFor<const wchar_t*> {static bool format(StringFormatOutput&, const StringView, const wchar_t*);};
#endif

template <int N> struct StringFormatterFor<SmallString<N>> {static bool format(StringFormatOutput& sfo, const StringView sv, const SmallString<N>& s){return StringFormatterFor<StringView>::format(sfo,sv,s.view());}};
// clang-format on

template <int N>
Expand Down

0 comments on commit 4efa35b

Please sign in to comment.