From: Orvid King Date: Fri, 31 Jul 2015 19:40:07 +0000 (-0700) Subject: Use constexpr initializers for AtomicHashArray Config X-Git-Tag: v0.53.0~19 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f02969dfd3b7a9ac0b0cc8d8f84a12f92bb7ca7e;p=folly.git Use constexpr initializers for AtomicHashArray Config Summary: Closes #264 Modified by @sgolemon from the original PR to declare MSVC2015-final as the official minimum version, making the defines in the original PR unnecessary. Reviewed By: @yfeldblum Differential Revision: D2284130 Pulled By: @sgolemon --- diff --git a/folly/AtomicHashArray.h b/folly/AtomicHashArray.h index 7f12f862..be787695 100644 --- a/folly/AtomicHashArray.h +++ b/folly/AtomicHashArray.h @@ -128,9 +128,15 @@ class AtomicHashArray : boost::noncopyable { int entryCountThreadCacheSize; size_t capacity; // if positive, overrides maxLoadFactor - constexpr Config() : emptyKey((KeyT)-1), - lockedKey((KeyT)-2), - erasedKey((KeyT)-3), + private: + static constexpr KeyT kEmptyKey = (KeyT)-1; + static constexpr KeyT kLockedKey = (KeyT)-2; + static constexpr KeyT kErasedKey = (KeyT)-3; + + public: + constexpr Config() : emptyKey(kEmptyKey), + lockedKey(kLockedKey), + erasedKey(kErasedKey), maxLoadFactor(0.8), growthFactor(-1), entryCountThreadCacheSize(1000), diff --git a/folly/AtomicLinkedList.h b/folly/AtomicLinkedList.h index eca8de16..f24746a5 100644 --- a/folly/AtomicLinkedList.h +++ b/folly/AtomicLinkedList.h @@ -63,7 +63,7 @@ class AtomicLinkedList { * Note: list must be empty on destruction. */ ~AtomicLinkedList() { - assert(head_ == nullptr); + assert(empty()); } bool empty() const {