diff --git a/src/string.hh b/src/string.hh index 4604cd6f..50926787 100644 --- a/src/string.hh +++ b/src/string.hh @@ -25,8 +25,7 @@ public: explicit String(Codepoint cp, CharCount count = 1) { std::string str; - auto it = back_inserter(str); - utf8::dump(it, cp); + utf8::dump(back_inserter(str), cp); for (CharCount i = 0; i < count; ++i) m_content += str; } @@ -113,8 +112,7 @@ inline String operator"" _str(const char* str, size_t) inline String codepoint_to_str(Codepoint cp) { std::string str; - auto it = back_inserter(str); - utf8::dump(it, cp); + utf8::dump(back_inserter(str), cp); return String(str); } diff --git a/src/utf8.hh b/src/utf8.hh index 7b247092..ebbb430f 100644 --- a/src/utf8.hh +++ b/src/utf8.hh @@ -140,7 +140,7 @@ Codepoint codepoint(Iterator it) struct invalid_codepoint{}; template -void dump(OutputIterator& it, Codepoint cp) +void dump(OutputIterator&& it, Codepoint cp) { if (cp <= 0x7F) *it++ = cp;