Inline String::Data no-copy constructor
This commit is contained in:
parent
2289f350df
commit
c30a0e0ca2
|
@ -6,13 +6,6 @@
|
||||||
namespace Kakoune
|
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)
|
String::Data::Data(const char* data, size_t size, size_t capacity)
|
||||||
{
|
{
|
||||||
if (capacity > Short::capacity)
|
if (capacity > Short::capacity)
|
||||||
|
|
|
@ -178,7 +178,8 @@ public:
|
||||||
} s;
|
} s;
|
||||||
|
|
||||||
Data() { set_empty(); }
|
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, size_t capacity);
|
||||||
Data(const char* data, size_t size) : Data(data, size, size) {}
|
Data(const char* data, size_t size) : Data(data, size, size) {}
|
||||||
Data(const Data& other) : Data{other.data(), other.size()} {}
|
Data(const Data& other) : Data{other.data(), other.size()} {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user