Inline String::Data no-copy constructor

This commit is contained in:
Maxime Coste 2021-07-09 17:03:22 +10:00
parent 2289f350df
commit c30a0e0ca2
2 changed files with 2 additions and 8 deletions

View File

@ -6,13 +6,6 @@
namespace Kakoune
{
String::Data::Data(String::NoCopy, const char* data, size_t size)
{
l.ptr = const_cast<char*>(data);
l.size = size;
l.capacity = 0;
}
String::Data::Data(const char* data, size_t size, size_t capacity)
{
if (capacity > Short::capacity)

View File

@ -178,7 +178,8 @@ public:
} s;
Data() { set_empty(); }
Data(NoCopy, const char* data, size_t size);
Data(NoCopy, const char* data, size_t size) : l{const_cast<char*>(data), size, 0} {}
Data(const char* data, size_t size, size_t capacity);
Data(const char* data, size_t size) : Data(data, size, size) {}
Data(const Data& other) : Data{other.data(), other.size()} {}