Fix util::at(vector)
This commit is contained in:
parent
058505e9f0
commit
5df29246a5
1 changed files with 10 additions and 1 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue