Skip to content

Commit 9d53c25

Browse files
committed
task_08 fixes
1 parent 0ef8e2b commit 9d53c25

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

task_08/src/hashtable.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class HashTable {
3535
std::vector<K> keys();
3636
std::vector<T> values();
3737

38-
T& operator[](K key);
38+
T& operator[](const K& key);
3939
T& pop(K key);
4040
bool has_key(K key);
4141

@@ -103,7 +103,7 @@ void HashTable<K, T>::set_default(T default_value_) {
103103
}
104104

105105
template <hashable K, typename T>
106-
T& HashTable<K, T>::operator[](K key) {
106+
T& HashTable<K, T>::operator[](const K& key) {
107107
LinkedList<std::pair<K, T>>& key_list =
108108
hash_vector[(hasher(key)) % array_length];
109109

@@ -151,7 +151,7 @@ T& HashTable<K, T>::pop(K key) {
151151
return value;
152152
}
153153
}
154-
throw std::runtime_error("deleting a key that doesn't exist");
154+
throw std::runtime_error("out_of_range");
155155
}
156156

157157
template <hashable K, typename T>

0 commit comments

Comments
 (0)