38 #ifndef FCL_BROADPHASE_SIMPLEHASHTABLE_INL_H
39 #define FCL_BROADPHASE_SIMPLEHASHTABLE_INL_H
52 template<
typename Key,
typename Data,
typename HashFnc>
60 template<
typename Key,
typename Data,
typename HashFnc>
65 throw std::logic_error(
"SimpleHashTable must have non-zero size.");
73 template<
typename Key,
typename Data,
typename HashFnc>
76 std::vector<unsigned int> indices = h_(key);
77 size_t range = table_.size();
78 for(
size_t i = 0; i < indices.size(); ++i)
79 table_[indices[i] % range].push_back(value);
83 template<
typename Key,
typename Data,
typename HashFnc>
86 size_t range = table_.size();
87 std::vector<unsigned int> indices = h_(key);
88 std::set<Data> result;
89 for(
size_t i = 0; i < indices.size(); ++i)
91 unsigned int index = indices[i] % range;
92 std::copy(table_[index].begin(), table_[index].end(),
93 std::inserter(result, result.end()));
96 return std::vector<Data>(result.begin(), result.end());
100 template<
typename Key,
typename Data,
typename HashFnc>
103 size_t range = table_.size();
104 std::vector<unsigned int> indices = h_(key);
105 for(
size_t i = 0; i < indices.size(); ++i)
107 unsigned int index = indices[i] % range;
108 table_[index].remove(value);
113 template<
typename Key,
typename Data,
typename HashFnc>
117 table_.resize(table_size_);