-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMacros.h
40 lines (35 loc) · 1.06 KB
/
Macros.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include<exception>
#include<string>
#if __cplusplus > 202002L
#define _NODISCARD [[nodiscard]]
#define _CONSTEXPR20 constexpr
#define _PANAGIOTIS_BEGIN namespace panagiotis{
#define _PANAGIOTIS_END }
class bad_stack_access_ : public std::exception {
private:
std::string errorMessage; // To store the error message
public:
//Constructor to initialize the error message
explicit bad_stack_access_(const std::string& message)
: errorMessage(message) {
}
// Override the what() method
const char* what() const noexcept override {
return errorMessage.c_str();
}
};
class pop_from_empty_stack_ :public std::exception {
private:
std::string errorMessage; // To store the error message
public:
// Constructor to initialize the error message
explicit pop_from_empty_stack_(const std::string& message)
: errorMessage(message) {
}
//Override the what() method
const char* what() const noexcept override {
return errorMessage.c_str();
}
};
#endif