Fix util::hash_table inserting non-const pair

This commit is contained in:
Nikita Lisitsa 2023-08-26 12:32:54 +03:00
parent 24d1f1e5bf
commit 1d20bd5a17

View file

@ -296,6 +296,11 @@ namespace psemek::util
{
return static_cast<Hash const &>(*this)(pair.first);
}
std::size_t operator()(std::pair<Key, Value> const & pair) const
{
return static_cast<Hash const &>(*this)(pair.first);
}
};
template <typename Key, typename Value, typename Equal>
@ -320,6 +325,11 @@ namespace psemek::util
{
return static_cast<Equal const &>(*this)(pair1.first, pair2.first);
}
bool operator()(std::pair<Key, Value> const & pair1, std::pair<Key const, Value> const & pair2) const
{
return static_cast<Equal const &>(*this)(pair1.first, pair2.first);
}
};
}