diff options
1 files changed, 4 insertions, 3 deletions
| -rw-r--r-- | Year 2/Structures and data algorithms/Project/exa/SkipList.hpp | 7 |
diff --git a/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp b/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp index 4821aef..142c58a 100644 --- a/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp +++ b/Year 2/Structures and data algorithms/Project/exa/SkipList.hpp @@ -4,6 +4,7 @@ #include <istream> #include <ostream> #include <deque> +#include <exception> template <class T> class SkipList { @@ -158,7 +159,7 @@ bool SkipList<T>::addSkip(const T& start, const T& end) { template <class T> T SkipList<T>::pop() { if (empty()) - throw "Pop called on empty SkipList!"; + throw std::logic_error("Pop called on empty SkipList!"); T val = head->value; Node* oldHead = head; @@ -171,7 +172,7 @@ T SkipList<T>::pop() { template <class T> T& SkipList<T>::front() { if (empty()) - throw "Front called on empty SkipList!"; + throw std::logic_error("Front called on empty SkipList!"); return head->value; } @@ -179,7 +180,7 @@ T& SkipList<T>::front() { template <class T> T& SkipList<T>::back() { if (empty()) - throw "Back called on empty SkipList!"; + throw std::logic_error("Back called on empty SkipList!"); return tail->value; } |
