mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 08:34:39 +08:00
small cleanups.
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "hash_std.h" // defines Person with std::hash specialization
|
#include "hash_std.h" // defines Person with std::hash specialization
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <parallel_hashmap/phmap.h>
|
#include <parallel_hashmap/phmap.h>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|||||||
Vendored
+1
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <parallel_hashmap/phmap_utils.h>
|
#include <parallel_hashmap/phmap_utils.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
struct Person
|
struct Person
|
||||||
|
|||||||
Vendored
+13
@@ -51,6 +51,19 @@
|
|||||||
|
|
||||||
namespace phmap {
|
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 {
|
namespace type_traits_internal {
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
|
|||||||
Vendored
+2
-34
@@ -15,51 +15,20 @@
|
|||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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 <cstddef>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#define PHMAP_HASH_CLASS std::hash
|
|
||||||
|
|
||||||
namespace phmap
|
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>
|
template <class T>
|
||||||
struct Hash
|
struct Hash
|
||||||
{
|
{
|
||||||
inline size_t operator()(const T& __v) const
|
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>
|
template <class T>
|
||||||
inline void hash_combine(std::size_t& seed, T const& v)
|
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<std::size_t, sizeof(std::size_t)> combiner;
|
||||||
|
|
||||||
combiner(seed, hasher(v));
|
combiner(seed, phmap::Hash<T>()(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user