diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:30:42 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:30:42 +0200 |
commit | 767bb3951c65e38627cb0bbad9a3756e1cda2520 (patch) | |
tree | 460b18606d2c3472d5aa08444db4db62c6410248 /zen/string_base.h | |
parent | 6.0 (diff) | |
download | FreeFileSync-767bb3951c65e38627cb0bbad9a3756e1cda2520.tar.gz FreeFileSync-767bb3951c65e38627cb0bbad9a3756e1cda2520.tar.bz2 FreeFileSync-767bb3951c65e38627cb0bbad9a3756e1cda2520.zip |
6.1
Diffstat (limited to 'zen/string_base.h')
-rw-r--r-- | zen/string_base.h | 11 |
1 files changed, 5 insertions, 6 deletions
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 <algorithm> #include <cassert> #include <cstdint> +#include <atomic> #include "string_tools.h" -#include <boost/detail/atomic_count.hpp> //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<std::uint32_t>(len)), - capacity(static_cast<std::uint32_t>(cap)) {} + capacity(static_cast<std::uint32_t>(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 <atomic> std::atomic_int when finally getting rid of VS2010 std::uint32_t length; std::uint32_t capacity; //allocated size without null-termination + std::atomic<int> refCount; //practically no perf loss: ~0.2%! (FFS comparison) }; static Descriptor* descr( Char* ptr) { return reinterpret_cast< Descriptor*>(ptr) - 1; } |