From 375d3979cef9a204591094b2c102036bbdd08efe Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 29 Dec 2022 10:14:26 +0200 Subject: [SDP/P/exa] logic_errors are now thrown, replacing pure strings --- Year 2/Structures and data algorithms/Project/exa/SkipList.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 #include #include +#include template class SkipList { @@ -158,7 +159,7 @@ bool SkipList::addSkip(const T& start, const T& end) { template T SkipList::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::pop() { template T& SkipList::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::front() { template T& SkipList::back() { if (empty()) - throw "Back called on empty SkipList!"; + throw std::logic_error("Back called on empty SkipList!"); return tail->value; } -- cgit v1.3.1-23-gd82d