Add missing support for Codepoint in format

This commit is contained in:
Maxime Coste 2015-07-14 13:47:51 +01:00
parent c1b9ea4d1e
commit f87dbe410f
2 changed files with 10 additions and 0 deletions

View File

@ -151,6 +151,15 @@ InplaceString<24> to_string(float val)
return res; return res;
} }
InplaceString<8> to_string(Codepoint c)
{
InplaceString<8> res;
char* ptr = res.m_data;
utf8::dump(ptr, c);
res.m_length = (int)(ptr - res.m_data);
return res;
}
bool subsequence_match(StringView str, StringView subseq) bool subsequence_match(StringView str, StringView subseq)
{ {
auto it = str.begin(); auto it = str.begin();

View File

@ -277,6 +277,7 @@ InplaceString<16> to_string(int val);
InplaceString<24> to_string(size_t val); InplaceString<24> to_string(size_t val);
InplaceString<24> to_string(Hex val); InplaceString<24> to_string(Hex val);
InplaceString<24> to_string(float val); InplaceString<24> to_string(float val);
InplaceString<8> to_string(Codepoint c);
template<typename RealType, typename ValueType> template<typename RealType, typename ValueType>
decltype(to_string(std::declval<ValueType>())) decltype(to_string(std::declval<ValueType>()))