From 604e95f7719b23973b24d226ece91944f42e35f0 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 2 Mar 2015 23:55:41 +0000 Subject: Tweak StringData::create implementation --- src/shared_string.hh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/shared_string.hh') diff --git a/src/shared_string.hh b/src/shared_string.hh index 174d8234..d19a8353 100644 --- a/src/shared_string.hh +++ b/src/shared_string.hh @@ -28,10 +28,8 @@ struct StringData : UseMemoryDomain { const int len = (int)str.length() + (back != 0 ? 1 : 0); void* ptr = StringData::operator new(sizeof(StringData) + len + 1); - StringData* res = reinterpret_cast(ptr); + StringData* res = new (ptr) StringData(0, len);; std::copy(str.begin(), str.end(), res->data()); - res->refcount = 0; - res->length = len; if (back != 0) res->data()[len-1] = back; res->data()[len] = 0; -- cgit v1.2.3