xref: /freebsd/contrib/libcxxrt/stdexcept.h (revision 9a14aa017b21c292740c00ee098195cd46642730)
1 /**
2  * stdexcept.h - provides a stub version of <stdexcept>, which defines enough
3  * of the exceptions for the runtime to use.
4  */
5 
6 namespace std
7 {
8 
9 	class exception
10 	{
11 	public:
12 		exception() throw();
13 		exception(const exception&) throw();
14 		exception& operator=(const exception&) throw();
15 		virtual ~exception();
16 		virtual const char* what() const throw();
17 	};
18 
19 
20 	/**
21 	 * Bad allocation exception.  Thrown by ::operator new() if it fails.
22 	 */
23 	class bad_alloc: public exception
24 	{
25 	public:
26 		bad_alloc() throw();
27 		bad_alloc(const bad_alloc&) throw();
28 		bad_alloc& operator=(const bad_alloc&) throw();
29 		~bad_alloc();
30 		virtual const char* what() const throw();
31 	};
32 
33 	/**
34 	 * Bad cast exception.  Thrown by the __cxa_bad_cast() helper function.
35 	 */
36 	class bad_cast: public exception {
37 	public:
38 		bad_cast() throw();
39 		bad_cast(const bad_cast&) throw();
40 		bad_cast& operator=(const bad_cast&) throw();
41 		virtual ~bad_cast();
42 		virtual const char* what() const throw();
43 	};
44 
45 	/**
46 	 * Bad typeidexception.  Thrown by the __cxa_bad_typeid() helper function.
47 	 */
48 	class bad_typeid: public exception
49 	{
50 	public:
51 		bad_typeid() throw();
52 		bad_typeid(const bad_typeid &__rhs) throw();
53 		virtual ~bad_typeid();
54 		bad_typeid& operator=(const bad_typeid &__rhs) throw();
55 		virtual const char* what() const throw();
56 	};
57 
58 
59 
60 } // namespace std
61 
62