Skip to content

Commit

Permalink
add hvec_map::count method
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDodd committed Feb 23, 2024
1 parent a0e44ee commit 9f93631
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/hvec_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ class hvec_map : hash_vector_base {
size_t idx = hash_vector_base::find(&k, &cache);
return idx ? const_iterator(*this, idx - 1) : end();
}
size_t count(const KEY &k) const {
hash_vector_base::lookup_cache cache;
size_t idx = hash_vector_base::find(&k, &cache);
return idx > 0;
}

// FIXME -- how to do this without duplicating the code for lvalue/rvalue?
VAL &operator[](const KEY &k) {
Expand Down

0 comments on commit 9f93631

Please sign in to comment.