Make util::hash_table search heterogeneous & add hash_table::contains
This commit is contained in:
parent
183644d46f
commit
809a0ec212
1 changed files with 17 additions and 3 deletions
|
|
@ -344,9 +344,16 @@ namespace psemek::util
|
|||
return {result.first.as_const(), result.second};
|
||||
}
|
||||
|
||||
iterator find(T const & value) const
|
||||
template <typename Key>
|
||||
iterator find(Key const & key) const
|
||||
{
|
||||
return impl_.find(value).as_const();
|
||||
return impl_.find(key).as_const();
|
||||
}
|
||||
|
||||
template <typename Key>
|
||||
bool contains(Key const & key) const
|
||||
{
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
iterator begin() const
|
||||
|
|
@ -392,11 +399,18 @@ namespace psemek::util
|
|||
return impl_.insert(std::move(value));
|
||||
}
|
||||
|
||||
iterator find(Key const & key) const
|
||||
template <typename Key1>
|
||||
iterator find(Key1 const & key) const
|
||||
{
|
||||
return impl_.find(key);
|
||||
}
|
||||
|
||||
template <typename Key1>
|
||||
bool contains(Key1 const & key) const
|
||||
{
|
||||
return find(key) != end();
|
||||
}
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return impl_.begin();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue