38 #ifndef HPP_FCL_BROADPHASE_SIMPLEHASHTABLE_INL_H 39 #define HPP_FCL_BROADPHASE_SIMPLEHASHTABLE_INL_H 50 template <
typename Key,
typename Data,
typename HashFnc>
56 template <
typename Key,
typename Data,
typename HashFnc>
68 template <
typename Key,
typename Data,
typename HashFnc>
70 std::vector<unsigned int> indices =
h_(key);
71 size_t range =
table_.size();
72 for (
size_t i = 0; i < indices.size(); ++i)
73 table_[indices[i] % range].push_back(value);
77 template <
typename Key,
typename Data,
typename HashFnc>
79 size_t range =
table_.size();
80 std::vector<unsigned int> indices =
h_(key);
81 std::set<Data> result;
82 for (
size_t i = 0; i < indices.size(); ++i) {
83 size_t index = indices[i] % range;
85 std::inserter(result, result.end()));
88 return std::vector<Data>(result.begin(), result.end());
92 template <
typename Key,
typename Data,
typename HashFnc>
94 size_t range =
table_.size();
95 std::vector<unsigned int> indices =
h_(key);
96 for (
size_t i = 0; i < indices.size(); ++i) {
97 size_t index = indices[i] % range;
103 template <
typename Key,
typename Data,
typename HashFnc>
SimpleHashTable(const HashFnc &h)
std::vector< Data > query(Key key) const
Find the elements in the hash table whose key is the same as query key.
void init(size_t size)
Init the number of bins in the hash table.
void clear()
clear the hash table
void insert(Key key, Data value)
std::vector< Bin > table_
void remove(Key key, Data value)
remove the key-value pair from the table
#define HPP_FCL_THROW_PRETTY(message, exception)