Examples update to support C++17: exception specification throw removal
This commit is contained in:
parent
4e0b2f1402
commit
c9a10eb726
10 changed files with 40 additions and 119 deletions
|
|
@ -8,14 +8,6 @@ class FullError {
|
|||
FullError(int m) : maxsize(m) { }
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated" // dynamic exception specifications are deprecated in C++11
|
||||
#endif
|
||||
|
||||
template<typename T> class Queue {
|
||||
int maxsize;
|
||||
T *items;
|
||||
|
|
@ -31,7 +23,7 @@ template<typename T> class Queue {
|
|||
~Queue() {
|
||||
delete [] items;
|
||||
}
|
||||
void enqueue(T x) throw(FullError) {
|
||||
void enqueue(T x) {
|
||||
if (nitems == maxsize) {
|
||||
throw FullError(maxsize);
|
||||
}
|
||||
|
|
@ -51,11 +43,3 @@ template<typename T> class Queue {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
#if __GNUC__ >= 7
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue