Fix test warning related to update c++ 17 deprecation

This commit is contained in:
Brian McKinnon
2020-05-03 12:37:47 -05:00
parent 76da9dca62
commit 31de0ceeb8
2 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -1269,7 +1269,7 @@ namespace {
"key_compare_to_adapter should have adapted this comparator."); "key_compare_to_adapter should have adapted this comparator.");
static_assert( static_assert(
std::is_same<phmap::weak_ordering, std::is_same<phmap::weak_ordering,
phmap::result_of_t<Adapted(const K &, const K &)>>::value, phmap::invoke_result_t<Adapted, const K &, const K &>>::value,
"Adapted comparator should be a key-compare-to comparator."); "Adapted comparator should be a key-compare-to comparator.");
} }
template <typename Compare, typename K> template <typename Compare, typename K>
@@ -1280,7 +1280,7 @@ namespace {
"key_compare_to_adapter shouldn't have adapted this comparator."); "key_compare_to_adapter shouldn't have adapted this comparator.");
static_assert( static_assert(
std::is_same<bool, std::is_same<bool,
phmap::result_of_t<Unadapted(const K &, const K &)>>::value, phmap::invoke_result_t<Unadapted, const K &, const K &>>::value,
"Un-adapted comparator should return bool."); "Un-adapted comparator should return bool.");
} }
+6 -5
View File
@@ -440,8 +440,9 @@ namespace container_internal {
class CountingAllocator : public std::allocator<T> { class CountingAllocator : public std::allocator<T> {
public: public:
using Alloc = std::allocator<T>; using Alloc = std::allocator<T>;
using pointer = typename Alloc::pointer; using AllocTraits = typename std::allocator_traits<Alloc>;
using size_type = typename Alloc::size_type; using pointer = typename AllocTraits::pointer;
using size_type = typename AllocTraits::size_type;
CountingAllocator() : bytes_used_(nullptr) {} CountingAllocator() : bytes_used_(nullptr) {}
explicit CountingAllocator(int64_t* b) : bytes_used_(b) {} explicit CountingAllocator(int64_t* b) : bytes_used_(b) {}
@@ -451,14 +452,14 @@ namespace container_internal {
: Alloc(x), bytes_used_(x.bytes_used_) {} : Alloc(x), bytes_used_(x.bytes_used_) {}
pointer allocate(size_type n, pointer allocate(size_type n,
std::allocator<void>::const_pointer hint = nullptr) { std::allocator_traits<std::allocator<void>>::const_pointer hint = nullptr) {
assert(bytes_used_ != nullptr); assert(bytes_used_ != nullptr);
*bytes_used_ += n * sizeof(T); *bytes_used_ += n * sizeof(T);
return Alloc::allocate(n, hint); return AllocTraits::allocate(*this, n, hint);
} }
void deallocate(pointer p, size_type n) { void deallocate(pointer p, size_type n) {
Alloc::deallocate(p, n); AllocTraits::deallocate(*this, p, n);
assert(bytes_used_ != nullptr); assert(bytes_used_ != nullptr);
*bytes_used_ -= n * sizeof(T); *bytes_used_ -= n * sizeof(T);
} }