diff --git a/headers/Problem.hpp b/headers/Problem.hpp index 2fdc3a8..026dbbc 100644 --- a/headers/Problem.hpp +++ b/headers/Problem.hpp @@ -34,6 +34,12 @@ protected: const std::string description; //Holds the description of the problem mee::Stopwatch timer; //Used to determine your algorithm's run time bool solved; //Holds true after the problem has been solved + //Make sure the problem has been solved and throw an exception if not + void solvedCheck(std::string str) const{ + if(!solved){ + throw new Unsolved("You must solve the problem before you can see the " + str); + } + } public: //Constructors Problem() : solved(false){ @@ -68,11 +74,6 @@ public: timer.reset(); solved = false; } - void solvedCheck(std::string str) const{ - if(!solved){ - throw new Unsolved("You must solve the problem before you can see the " + str); - } - } //Pure virtual functions //Solve the problem virtual void solve() = 0;