From 31de0ceeb863062622376965adf462814b38384f Mon Sep 17 00:00:00 2001 From: Brian McKinnon Date: Sun, 3 May 2020 12:37:47 -0500 Subject: [PATCH] Fix test warning related to update c++ 17 deprecation --- tests/btree_test.cc | 4 ++-- tests/btree_test.h | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/btree_test.cc b/tests/btree_test.cc index 858c6df..31e73c0 100644 --- a/tests/btree_test.cc +++ b/tests/btree_test.cc @@ -1269,7 +1269,7 @@ namespace { "key_compare_to_adapter should have adapted this comparator."); static_assert( std::is_same>::value, + phmap::invoke_result_t>::value, "Adapted comparator should be a key-compare-to comparator."); } template @@ -1280,7 +1280,7 @@ namespace { "key_compare_to_adapter shouldn't have adapted this comparator."); static_assert( std::is_same>::value, + phmap::invoke_result_t>::value, "Un-adapted comparator should return bool."); } diff --git a/tests/btree_test.h b/tests/btree_test.h index 7f7438f..66c331d 100644 --- a/tests/btree_test.h +++ b/tests/btree_test.h @@ -440,8 +440,9 @@ namespace container_internal { class CountingAllocator : public std::allocator { public: using Alloc = std::allocator; - using pointer = typename Alloc::pointer; - using size_type = typename Alloc::size_type; + using AllocTraits = typename std::allocator_traits; + using pointer = typename AllocTraits::pointer; + using size_type = typename AllocTraits::size_type; CountingAllocator() : bytes_used_(nullptr) {} explicit CountingAllocator(int64_t* b) : bytes_used_(b) {} @@ -451,14 +452,14 @@ namespace container_internal { : Alloc(x), bytes_used_(x.bytes_used_) {} pointer allocate(size_type n, - std::allocator::const_pointer hint = nullptr) { + std::allocator_traits>::const_pointer hint = nullptr) { assert(bytes_used_ != nullptr); *bytes_used_ += n * sizeof(T); - return Alloc::allocate(n, hint); + return AllocTraits::allocate(*this, n, hint); } void deallocate(pointer p, size_type n) { - Alloc::deallocate(p, n); + AllocTraits::deallocate(*this, p, n); assert(bytes_used_ != nullptr); *bytes_used_ -= n * sizeof(T); }