// find in or add to index
const uint32_t hash = cmd_t::hash(cmd);
- cmp_t<cmd_t> cmp;
- size_t idx = index.find_with(hash, cmd, cmp);
+ size_t idx = index.find_with(hash, cmd, cmp_t<cmd_t>());
if (idx == lookup_t<cmd_t*>::NIL) {
idx = index.push(hash, cmd);
}
size_t ntags;
explicit eqtag_t(size_t n): ntags(n) {}
- inline tagver_t operator()(const tagver_t *x, const tagver_t *y)
+ inline tagver_t operator()(const tagver_t *x, const tagver_t *y) const
{
return memcmp(x, y, ntags * sizeof(tagver_t)) == 0;
}
const size_t size = ntags * sizeof(tagver_t);
const uint32_t hash = hash32(0, tags, size);
- eqtag_t eq(ntags);
- const size_t idx = lookup.find_with(hash, tags, eq);
+ const size_t idx = lookup.find_with(hash, tags, eqtag_t(ntags));
if (idx != taglookup_t::NIL) {
return idx;
}
const data_t& operator[](size_t idx) const;
size_t push(hash_t h, const data_t &data);
template<typename pred_t>
- size_t find_with(hash_t h, const data_t &data, pred_t &pred) const;
+ size_t find_with(hash_t h, const data_t &data, const pred_t &pred) const;
private:
size_t head(hash_t) const;
template<typename data_t, typename hash_t>
template<typename pred_t>
-size_t lookup_t<data_t, hash_t>::find_with(hash_t h, const data_t &data, pred_t &pred) const
+size_t lookup_t<data_t, hash_t>::find_with(hash_t h, const data_t &data, const pred_t &pred) const
{
for (size_t i = head(h); i != NIL;) {
const elem_t &e = elems[i];