diff options
Diffstat (limited to 'src/common/String.cpp')
-rw-r--r-- | src/common/String.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/String.cpp b/src/common/String.cpp index 1c2ff022..21f3f235 100644 --- a/src/common/String.cpp +++ b/src/common/String.cpp @@ -39,13 +39,20 @@ String::String(const_pointer str, Index size) { this->capacity_ = size; } +String::String(size_type size, value_type ch) : String() { + reserve(size); + for (Index i = 0; i < size; i++) { + append(ch); + } +} + String::String(std::initializer_list<char16_t> l) : String(l.begin(), l.size()) {} #ifdef CRU_PLATFORM_WINDOWS String::String(const wchar_t* str) : String(str, GetStrSize(str)) {} String::String(const wchar_t* str, Index size) - : String(reinterpret_cast<const std::uint16_t*>(str), size) {} + : String(reinterpret_cast<const char16_t*>(str), size) {} #endif String::String(const String& other) { @@ -426,7 +433,7 @@ std::vector<FormatToken> ParseToFormatTokenList(const String& str) { void FormatAppendFromFormatTokenList( String& current, const std::vector<FormatToken>& format_token_list, Index index) { - for (Index i = index; i < format_token_list.size(); i++) { + for (Index i = index; i < static_cast<Index>(format_token_list.size()); i++) { const auto& token = format_token_list[i]; if (token.type == FormatTokenType::PlaceHolder) { current += u"{}"; |