From 767bb3951c65e38627cb0bbad9a3756e1cda2520 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:30:42 +0200 Subject: 6.1 --- zen/string_base.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'zen/string_base.h') diff --git a/zen/string_base.h b/zen/string_base.h index c828b240..0e3bbdd3 100644 --- a/zen/string_base.h +++ b/zen/string_base.h @@ -10,8 +10,8 @@ #include #include #include +#include #include "string_tools.h" -#include //Zbase - a policy based string class optimizing performance and flexibility @@ -168,15 +168,14 @@ protected: private: struct Descriptor { - Descriptor(long rc, size_t len, size_t cap) : - refCount(rc), + Descriptor(int rc, size_t len, size_t cap) : length (static_cast(len)), - capacity(static_cast(cap)) {} + capacity(static_cast(cap)), + refCount(rc) { assert_static(ATOMIC_INT_LOCK_FREE == 2); } //2: "the types are always lock-free" - boost::detail::atomic_count refCount; //practically no perf loss: ~0.2%! (FFS comparison) - //replace by #include std::atomic_int when finally getting rid of VS2010 std::uint32_t length; std::uint32_t capacity; //allocated size without null-termination + std::atomic refCount; //practically no perf loss: ~0.2%! (FFS comparison) }; static Descriptor* descr( Char* ptr) { return reinterpret_cast< Descriptor*>(ptr) - 1; } -- cgit