mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-31 01:20:40 +08:00
Add example mt_word_counter
This commit is contained in:
Vendored
+32
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <mutex>
|
||||
|
||||
#if defined(PHMAP_USE_ABSL_HASH) && !defined(ABSL_HASH_HASH_H_)
|
||||
namespace absl { template <class T> struct Hash; };
|
||||
@@ -127,6 +128,37 @@ namespace phmap {
|
||||
class Mutex = phmap::NullMutex> // use std::mutex to enable internal locks
|
||||
class parallel_node_hash_map;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// phmap::parallel_*_hash_* using std::mutex by default
|
||||
// -----------------------------------------------------------------------------
|
||||
template <class T,
|
||||
class Hash = phmap::priv::hash_default_hash<T>,
|
||||
class Eq = phmap::priv::hash_default_eq<T>,
|
||||
class Alloc = phmap::priv::Allocator<T>,
|
||||
size_t N = 4>
|
||||
using parallel_flat_hash_set_m = parallel_flat_hash_set<T, Hash, Eq, Alloc, N, std::mutex>;
|
||||
|
||||
template <class K, class V,
|
||||
class Hash = phmap::priv::hash_default_hash<K>,
|
||||
class Eq = phmap::priv::hash_default_eq<K>,
|
||||
class Alloc = phmap::priv::Allocator<phmap::priv::Pair<const K, V>>,
|
||||
size_t N = 4>
|
||||
using parallel_flat_hash_map_m = parallel_flat_hash_map<K, V, Hash, Eq, Alloc, N, std::mutex>;
|
||||
|
||||
template <class T,
|
||||
class Hash = phmap::priv::hash_default_hash<T>,
|
||||
class Eq = phmap::priv::hash_default_eq<T>,
|
||||
class Alloc = phmap::priv::Allocator<T>,
|
||||
size_t N = 4>
|
||||
using parallel_node_hash_set_m = parallel_node_hash_set<T, Hash, Eq, Alloc, N, std::mutex>;
|
||||
|
||||
template <class K, class V,
|
||||
class Hash = phmap::priv::hash_default_hash<K>,
|
||||
class Eq = phmap::priv::hash_default_eq<K>,
|
||||
class Alloc = phmap::priv::Allocator<phmap::priv::Pair<const K, V>>,
|
||||
size_t N = 4>
|
||||
using parallel_node_hash_map_m = parallel_node_hash_map<K, V, Hash, Eq, Alloc, N, std::mutex>;
|
||||
|
||||
// ------------- forward declarations for btree containers ----------------------------------
|
||||
template <typename Key, typename Compare = phmap::Less<Key>,
|
||||
typename Alloc = phmap::Allocator<Key>>
|
||||
|
||||
Reference in New Issue
Block a user