From 9f9ad58b397f7af5f84cf07056b61f8b648d9842 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 27 Feb 2013 21:36:28 +0100 Subject: [PATCH] utf8::dump uses a copy of the output iterator instead of a reference --- src/string.hh | 6 ++---- src/utf8.hh | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) 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;