38#ifndef COAL_BROADPHASE_SPARSEHASHTABLE_H
39#define COAL_BROADPHASE_SPARSEHASHTABLE_H
44#include <unordered_map>
50template <
typename U,
typename V>
52 typedef std::unordered_map<U, V> Base;
59template <
typename Key,
typename Data,
typename HashFnc,
60 template <
typename,
typename>
class TableT = unordered_map_hash_table>
64 typedef std::list<Data>
Bin;
65 typedef TableT<size_t, Bin>
Table;
76 void insert(Key key, Data value);
79 std::vector<Data>
query(Key key)
const;
82 void remove(Key key, Data value);
A hash table implemented using unordered_map.
Definition sparse_hash_table.h:61
void clear()
clear the hash table
Definition sparse_hash_table-inl.h:104
void insert(Key key, Data value)
insert one key-value pair into the hash table
Definition sparse_hash_table-inl.h:65
Table table_
Definition sparse_hash_table.h:67
std::list< Data > Bin
Definition sparse_hash_table.h:64
TableT< size_t, Bin > Table
Definition sparse_hash_table.h:65
HashFnc h_
Definition sparse_hash_table.h:63
void init(size_t)
Init the hash table. The bucket size is dynamically decided.
Definition sparse_hash_table-inl.h:58
std::vector< Data > query(Key key) const
find the elements whose key is the same as the query
Definition sparse_hash_table-inl.h:74
void remove(Key key, Data value)
remove one key-value pair from the hash table
Definition sparse_hash_table-inl.h:93
Definition sparse_hash_table.h:51
unordered_map_hash_table()
Definition sparse_hash_table.h:55
Main namespace.
Definition broadphase_bruteforce.h:44