Add a String(Codepoint, CharCount) constructor

This commit is contained in:
Maxime Coste 2013-02-26 14:28:20 +01:00
parent 2726d11108
commit ffc5a4a334

View File

@ -24,6 +24,14 @@ public:
String(const String& string) = default; String(const String& string) = default;
String(String&& string) = default; String(String&& string) = default;
explicit String(char content, CharCount count = 1) : m_content((size_t)(int)count, content) {} 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<typename Iterator> template<typename Iterator>
String(Iterator begin, Iterator end) : m_content(begin, end) {} String(Iterator begin, Iterator end) : m_content(begin, end) {}