From e016df0246a21f99b5696a4b2a4f66513f1202f5 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 30 Mar 2019 20:50:47 -0400 Subject: [PATCH] small cleanups. --- examples/hash_std.cc | 4 +--- examples/hash_std.h | 1 + parallel_hashmap/phmap_base.h | 13 ++++++++++++ parallel_hashmap/phmap_utils.h | 36 ++-------------------------------- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/examples/hash_std.cc b/examples/hash_std.cc index fdec8c8..20eef8f 100644 --- a/examples/hash_std.cc +++ b/examples/hash_std.cc @@ -1,8 +1,6 @@ -#include -#include - #include "hash_std.h" // defines Person with std::hash specialization +#include #include int main() diff --git a/examples/hash_std.h b/examples/hash_std.h index 4fd8dfa..03dfe64 100644 --- a/examples/hash_std.h +++ b/examples/hash_std.h @@ -3,6 +3,7 @@ #include +#include using std::string; struct Person diff --git a/parallel_hashmap/phmap_base.h b/parallel_hashmap/phmap_base.h index 9c9362f..3f38c4e 100644 --- a/parallel_hashmap/phmap_base.h +++ b/parallel_hashmap/phmap_base.h @@ -51,6 +51,19 @@ namespace phmap { +template using Allocator = typename std::allocator; + +template using Pair = typename std::pair; + +template +struct EqualTo +{ + inline size_t operator()(const T& a, const T& b) const + { + return std::equal_to()(a, b); + } +}; + namespace type_traits_internal { template diff --git a/parallel_hashmap/phmap_utils.h b/parallel_hashmap/phmap_utils.h index 60ce20e..1db808a 100644 --- a/parallel_hashmap/phmap_utils.h +++ b/parallel_hashmap/phmap_utils.h @@ -15,51 +15,20 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// -// Includes work from abseil-cpp (https://github.com/abseil/abseil-cpp) -// with modifications. -// -// Copyright 2018 The Abseil Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. // --------------------------------------------------------------------------- //#include #include -#define PHMAP_HASH_CLASS std::hash namespace phmap { -template using Allocator = typename std::allocator; - -template using Pair = typename std::pair; - -template -struct EqualTo -{ - inline size_t operator()(const T& a, const T& b) const - { - return std::equal_to()(a, b); - } -}; - template struct Hash { inline size_t operator()(const T& __v) const { - return PHMAP_HASH_CLASS()(__v); + return std::hash()(__v); } }; @@ -231,10 +200,9 @@ template struct Combiner template inline void hash_combine(std::size_t& seed, T const& v) { - phmap::Hash hasher; Combiner combiner; - combiner(seed, hasher(v)); + combiner(seed, phmap::Hash()(v)); } }