CppELib 1.7.0
Loading...
Searching...
No Matches
ContainerException.h
Go to the documentation of this file.
1#ifndef CONTAINER_EXCEPTION_H_INCLUDED
2#define CONTAINER_EXCEPTION_H_INCLUDED
3
4#include <exception>
5
7#ifdef CPPELIB_NO_EXCEPTIONS
9#define CPPELIB_CONTAINER_THROW(x) CHECK_ASSERT(false && #x)
10#else
11#define CPPELIB_CONTAINER_THROW(x) throw x
12#endif
13
14#if (__cplusplus >= 201103L)
15#define CPPELIB_CONTAINER_NOEXCEPT noexcept
16#else
17#define CPPELIB_CONTAINER_NOEXCEPT throw()
18#endif
20
21namespace Container {
22
23class OutOfRange : public std::exception {
24public:
25 explicit OutOfRange(const char* msg) : m_msg(msg) {}
26 const char* what() const CPPELIB_CONTAINER_NOEXCEPT
27 {
28 return m_msg;
29 }
30private:
31 const char* m_msg;
32};
33
34class BadAlloc : public std::exception {
35public:
37 virtual const char* what() const CPPELIB_CONTAINER_NOEXCEPT = 0;
38};
39
40}
41
42#endif // CONTAINER_EXCEPTION_H_INCLUDED
Definition ContainerException.h:34
BadAlloc()
Definition ContainerException.h:36
virtual const char * what() const CPPELIB_CONTAINER_NOEXCEPT=0
Definition ContainerException.h:23
const char * what() const CPPELIB_CONTAINER_NOEXCEPT
Definition ContainerException.h:26
OutOfRange(const char *msg)
Definition ContainerException.h:25
Definition Array.h:10