Fix util::at(vector)

This commit is contained in:
Nikita Lisitsa 2024-07-17 19:43:54 +03:00
parent 058505e9f0
commit 5df29246a5

View file

@ -60,7 +60,16 @@ namespace psemek::util
}
template <typename T, typename Key>
auto & at(std::vector<T> && container, Key const & key)
auto & at(std::vector<T> & container, Key const & key)
{
if (key < container.size())
return container[key];
throw key_error<Key>(key);
}
template <typename T, typename Key>
auto & at(std::vector<T> const & container, Key const & key)
{
if (key < container.size())
return container[key];