From 4fb9440e9558fed4d1a28e8b218a7449d5a3f6b6 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Tue, 18 Jul 2017 10:01:30 -0700 Subject: [PATCH] Ensure the allocator types in the string keyed tests have value_types matching the value type of the collection Summary: Because MSVC's standard library implementation is now checking that this is actually the case: ``` error C2338: set requires that Allocator's value_type match T (See N4659 26.2.1 [container.requirements.general]/16 allocator_type) Either fix the allocator value_type or define _ENFORCE_MATCHING_ALLOCATORS=0 to suppress this diagnostic. ``` I've gone with the "Fix the `value_type`" approach. Reviewed By: yfeldblum Differential Revision: D5441017 fbshipit-source-id: b30403d2e48f815177cac29c4e6eec4e79583660 --- folly/experimental/test/StringKeyedTest.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/folly/experimental/test/StringKeyedTest.cpp b/folly/experimental/test/StringKeyedTest.cpp index 3fbcc021..1a9a6c41 100644 --- a/folly/experimental/test/StringKeyedTest.cpp +++ b/folly/experimental/test/StringKeyedTest.cpp @@ -110,21 +110,22 @@ private: Alloc alloc_; }; -typedef MemoryLeakCheckerAllocator> KeyLeakChecker; -typedef MemoryLeakCheckerAllocator< - std::allocator>> ValueLeakChecker; +using KeyValuePairLeakChecker = MemoryLeakCheckerAllocator< + std::allocator>>; +using ValueLeakChecker = + MemoryLeakCheckerAllocator>; typedef StringKeyedUnorderedMap< int, folly::Hash, std::equal_to, - ValueLeakChecker> + KeyValuePairLeakChecker> LeakCheckedUnorderedMap; typedef StringKeyedSetBase, ValueLeakChecker> LeakCheckedSet; -typedef StringKeyedMap, ValueLeakChecker> +typedef StringKeyedMap, KeyValuePairLeakChecker> LeakCheckedMap; using LeakCheckedUnorderedSet = BasicStringKeyedUnorderedSet< -- 2.34.1