utf8::dump uses a copy of the output iterator instead of a reference

This commit is contained in:
Maxime Coste 2013-02-27 21:36:28 +01:00
parent 8e07e00f18
commit 9f9ad58b39
2 changed files with 3 additions and 5 deletions

View File

@ -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);
}

View File

@ -140,7 +140,7 @@ Codepoint codepoint(Iterator it)
struct invalid_codepoint{};
template<typename OutputIterator>
void dump(OutputIterator& it, Codepoint cp)
void dump(OutputIterator&& it, Codepoint cp)
{
if (cp <= 0x7F)
*it++ = cp;