From: Martin Martin Date: Tue, 12 Sep 2017 18:51:07 +0000 (-0700) Subject: const -> constexpr in folly::small_vector X-Git-Tag: v2017.09.18.00~14 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d3555e67ca3c8ad89eda5e689d46cd7fa2840356;p=folly.git const -> constexpr in folly::small_vector Summary: const -> constexpr in folly::small_vector Reviewed By: yfeldblum Differential Revision: D5814264 fbshipit-source-id: 4631bb7f3f04906636e5a188d4aa0d33ad796a3c --- diff --git a/folly/small_vector.h b/folly/small_vector.h index 668181c7..a369e7ee 100644 --- a/folly/small_vector.h +++ b/folly/small_vector.h @@ -259,10 +259,10 @@ struct IntegralSizePolicy { } protected: - static bool const kShouldUseHeap = ShouldUseHeap; + static bool constexpr kShouldUseHeap = ShouldUseHeap; private: - static SizeType const kExternMask = + static SizeType constexpr kExternMask = kShouldUseHeap ? SizeType(1) << (sizeof(SizeType) * 8 - 1) : 0; SizeType size_; @@ -1081,15 +1081,17 @@ class small_vector : public detail::small_vector_base< InlineStorageDataType, void*>::type InlineStorageType; - static bool const kHasInlineCapacity = + static bool constexpr kHasInlineCapacity = sizeof(HeapPtrWithCapacity) < sizeof(InlineStorageType); // This value should we multiple of word size. - static size_t const kHeapifyCapacitySize = sizeof( + static size_t constexpr kHeapifyCapacitySize = sizeof( typename std:: aligned_storage::type); + // Threshold to control capacity heapifying. - static size_t const kHeapifyCapacityThreshold = 100 * kHeapifyCapacitySize; + static size_t constexpr kHeapifyCapacityThreshold = + 100 * kHeapifyCapacitySize; typedef typename std:: conditional::type