From ffc5a4a334d5434f42d695f0725fe9131bfea5a9 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 26 Feb 2013 14:28:20 +0100 Subject: [PATCH] Add a String(Codepoint, CharCount) constructor --- src/string.hh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/string.hh b/src/string.hh index f86e0661..f93c04d3 100644 --- a/src/string.hh +++ b/src/string.hh @@ -24,6 +24,14 @@ public: String(const String& string) = default; String(String&& string) = default; explicit String(char content, CharCount count = 1) : m_content((size_t)(int)count, content) {} + explicit String(Codepoint cp, CharCount count = 1) + { + std::string str; + auto it = back_inserter(str); + utf8::dump(it, cp); + for (CharCount i = 0; i < count; ++i) + m_content += str; + } template String(Iterator begin, Iterator end) : m_content(begin, end) {}