Data Structures Class Templates
Various data structures implemented using c++ class templates.
stackerror.h
Go to the documentation of this file.
1 #pragma once
2 #include <stdexcept>
3 #include <string>
4 
14 class StackError: public std::runtime_error {
15 public:
20  StackError(const char* msg="StackError"): runtime_error(msg), msg(msg) {}
21 
26  const char* what() const noexcept {
27  return msg.c_str();
28  }
29 protected:
30  std::string msg;
31 };
32 
33 #include "stackoverflowerror.h"
34 #include "stackunderflowerror.h"
StackError::what
const char * what() const noexcept
Overridden what() method from std::runtime_error.
Definition: stackerror.h:26
stackoverflowerror.h
Contains implementation of the StackOverflowError class.
StackError::msg
std::string msg
Definition: stackerror.h:30
StackError::StackError
StackError(const char *msg="StackError")
Constructor.
Definition: stackerror.h:20
StackError
Base class for all Stack related exceptions.
Definition: stackerror.h:14
stackunderflowerror.h
Contains implementation of the StackUnderflowError class.