small cleanups.

This commit is contained in:
greg
2019-03-30 20:50:47 -04:00
parent d0c2c9a2d2
commit e016df0246
4 changed files with 17 additions and 37 deletions
+13
View File
@@ -51,6 +51,19 @@
namespace phmap {
template <class T> using Allocator = typename std::allocator<T>;
template<class T1, class T2> using Pair = typename std::pair<T1, T2>;
template <class T>
struct EqualTo
{
inline size_t operator()(const T& a, const T& b) const
{
return std::equal_to<T>()(a, b);
}
};
namespace type_traits_internal {
template <typename... Ts>
+2 -34
View File
@@ -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 <cstddef>
#include <functional>
#define PHMAP_HASH_CLASS std::hash
namespace phmap
{
template <class T> using Allocator = typename std::allocator<T>;
template<class T1, class T2> using Pair = typename std::pair<T1, T2>;
template <class T>
struct EqualTo
{
inline size_t operator()(const T& a, const T& b) const
{
return std::equal_to<T>()(a, b);
}
};
template <class T>
struct Hash
{
inline size_t operator()(const T& __v) const
{
return PHMAP_HASH_CLASS<T>()(__v);
return std::hash<T>()(__v);
}
};
@@ -231,10 +200,9 @@ template <class T> struct Combiner<T, 8>
template <class T>
inline void hash_combine(std::size_t& seed, T const& v)
{
phmap::Hash<T> hasher;
Combiner<std::size_t, sizeof(std::size_t)> combiner;
combiner(seed, hasher(v));
combiner(seed, phmap::Hash<T>()(v));
}
}