From: Christopher Dykes Date: Sat, 3 Dec 2016 00:45:01 +0000 (-0800) Subject: Get ConcurrentSkipList functional X-Git-Tag: v2016.12.05.00~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=42c5202563c9ba646ab852c5900978e56c711293;p=folly.git Get ConcurrentSkipList functional Summary: MSVC was getting thoroughly confused while trying to eval the constexpr function, so switch it to a template instead. MSVC was also failing to wrap it's head around what a NodeRecycler is, so delay its resolution via typename. Reviewed By: yfeldblum Differential Revision: D3478755 fbshipit-source-id: f687f4538fb12ef8eee525557f4cc988a09e714d --- diff --git a/folly/ConcurrentSkipList-inl.h b/folly/ConcurrentSkipList-inl.h index e4144bcb..a0dab2f3 100644 --- a/folly/ConcurrentSkipList-inl.h +++ b/folly/ConcurrentSkipList-inl.h @@ -70,10 +70,9 @@ class SkipListNode : private boost::noncopyable { } template - static constexpr bool destroyIsNoOp() { - return IsArenaAllocator::value && - boost::has_trivial_destructor::value; - } + struct DestroyIsNoOp : std::integral_constant::value && + boost::has_trivial_destructor::value> { }; // copy the head node to a new head node assuming lock acquired SkipListNode* copyHead(SkipListNode* node) { @@ -230,7 +229,7 @@ class NodeRecycler; template class NodeRecycler()>::type> { + !NodeType::template DestroyIsNoOp::value>::type> { public: explicit NodeRecycler(const NodeAlloc& alloc) : refs_(0), dirty_(false), alloc_(alloc) { lock_.init(); } @@ -316,7 +315,7 @@ class NodeRecycler class NodeRecycler()>::type> { + NodeType::template DestroyIsNoOp::value>::type> { public: explicit NodeRecycler(const NodeAlloc& alloc) : alloc_(alloc) { } diff --git a/folly/ConcurrentSkipList.h b/folly/ConcurrentSkipList.h index 2f8f0254..31ca1d1d 100644 --- a/folly/ConcurrentSkipList.h +++ b/folly/ConcurrentSkipList.h @@ -195,7 +195,7 @@ class ConcurrentSkipList { //=================================================================== ~ConcurrentSkipList() { - /* static */ if (NodeType::template destroyIsNoOp()) { + /* static */ if (NodeType::template DestroyIsNoOp::value) { // Avoid traversing the list if using arena allocator. return; }