13#include "libmesh/threads.h"
15#include <unordered_map>
17template <
typename Key,
typename T>
18class HashMap :
public std::unordered_map<Key, T>
24 return std::unordered_map<Key, T>::operator[](k);
27 inline std::size_t
erase(
const Key & k)
30 return std::unordered_map<Key, T>::erase(k);
33 using typename std::unordered_map<Key, T>::const_iterator;
34 using typename std::unordered_map<Key, T>::iterator;
36 inline iterator
find(
const Key & k)
39 return std::unordered_map<Key, T>::find(k);
42 inline const_iterator
find(
const Key & k)
const
45 return std::unordered_map<Key, T>::find(k);
48 inline bool contains(
const Key & key)
const {
return this->
find(key) != this->end(); }
HashMap is an abstraction for dictionary data type, we make it thread-safe by locking inserts.
iterator find(const Key &k)
bool contains(const Key &key) const
const_iterator find(const Key &k) const
std::size_t erase(const Key &k)
libMesh::Threads::spin_mutex spin_mutex
T & operator[](const Key &k)