From: Christopher Dykes Date: Tue, 18 Jul 2017 17:01:30 +0000 (-0700) Subject: Ensure the allocator types in the string keyed tests have value_types matching the... X-Git-Tag: v2017.07.17.01~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4fb9440e9558fed4d1a28e8b218a7449d5a3f6b6;p=folly.git 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 --- 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<