Commit f02969df authored by Orvid King's avatar Orvid King Committed by facebook-github-bot-4

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
parent 117385fb
...@@ -128,9 +128,15 @@ class AtomicHashArray : boost::noncopyable { ...@@ -128,9 +128,15 @@ class AtomicHashArray : boost::noncopyable {
int entryCountThreadCacheSize; int entryCountThreadCacheSize;
size_t capacity; // if positive, overrides maxLoadFactor size_t capacity; // if positive, overrides maxLoadFactor
constexpr Config() : emptyKey((KeyT)-1), private:
lockedKey((KeyT)-2), static constexpr KeyT kEmptyKey = (KeyT)-1;
erasedKey((KeyT)-3), static constexpr KeyT kLockedKey = (KeyT)-2;
static constexpr KeyT kErasedKey = (KeyT)-3;
public:
constexpr Config() : emptyKey(kEmptyKey),
lockedKey(kLockedKey),
erasedKey(kErasedKey),
maxLoadFactor(0.8), maxLoadFactor(0.8),
growthFactor(-1), growthFactor(-1),
entryCountThreadCacheSize(1000), entryCountThreadCacheSize(1000),
......
...@@ -63,7 +63,7 @@ class AtomicLinkedList { ...@@ -63,7 +63,7 @@ class AtomicLinkedList {
* Note: list must be empty on destruction. * Note: list must be empty on destruction.
*/ */
~AtomicLinkedList() { ~AtomicLinkedList() {
assert(head_ == nullptr); assert(empty());
} }
bool empty() const { bool empty() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment