summaryrefslogtreecommitdiff
path: root/src/string.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2025-06-28 21:48:29 +1000
committerMaxime Coste <mawww@kakoune.org>2025-06-28 21:48:29 +1000
commit8561c2377c287a86e4603f5880606b64c3432dc1 (patch)
treebf07d6881130d6cddb275ad25fa1baecc09dc91f /src/string.hh
parentbc9dd1a962c82a0cd1a783995639c823f468e9a3 (diff)
Move some String constructors out of the header
Those do not really need to get inlined and pull std::max which really wants <algorithm> which is an expensive header.
Diffstat (limited to 'src/string.hh')
-rw-r--r--src/string.hh16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/string.hh b/src/string.hh
index 619971bd..4d7b60f9 100644
--- a/src/string.hh
+++ b/src/string.hh
@@ -109,21 +109,9 @@ public:
String() {}
String(const char* content) : m_data(content, (size_t)strlen(content)) {}
String(const char* content, ByteCount len) : m_data(content, (size_t)len) {}
- explicit String(Codepoint cp, CharCount count = 1)
- {
- reserve(utf8::codepoint_size(cp) * (int)count);
- while (count-- > 0)
- utf8::dump(std::back_inserter(*this), cp);
- }
- explicit String(Codepoint cp, ColumnCount count)
- {
- int cp_count = (int)(count / std::max(codepoint_width(cp), 1_col));
- reserve(utf8::codepoint_size(cp) * cp_count);
- while (cp_count-- > 0)
- utf8::dump(std::back_inserter(*this), cp);
- }
String(const char* begin, const char* end) : m_data(begin, end-begin) {}
-
+ explicit String(Codepoint cp, CharCount count = 1);
+ explicit String(Codepoint cp, ColumnCount count);
explicit String(StringView str);
struct NoCopy{};