Debian Codegraph @

headers/exception

raw
1 /* Copyright (C) 2015 Povilas Kanapickas <[email protected]>
2
3 This file is part of cppreference-doc
4
5 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
6 Unported License. To view a copy of this license, visit
7 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
8 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9
10 Permission is granted to copy, distribute and/or modify this document
11 under the terms of the GNU Free Documentation License, Version 1.3 or
12 any later version published by the Free Software Foundation; with no
13 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
14 */
15
16 #ifndef CPPREFERENCE_EXCEPTION_H
17 #define CPPREFERENCE_EXCEPTION_H
18
19 namespace std {
20
21 class exception {
22 public:
23 exception();
24 exception(const exception& other);
25 exception& operator=(const exception& other);
26 virtual const char* what() const;
27 };
28
29 #if CPPREFERENCE_STDVER>= 2011
30 class nested_exception {
31 public:
32 nested_exception();
33 nested_exception(const nested_exception& other) = default;
34 virtual ~nested_exception() = default;
35 nested_exception& operator=(const nested_exception& other) = default;
36 void rethrow_nested() const;
37 std::exception_ptr nested_ptr() const;
38 };
39
40 #endif // CPPREFERENCE_STDVER>= 2011
41
42 class bad_exception : public exception {
43 public:
44 bad_exception();
45 bad_exception(const bad_exception& other);
46 bad_exception& operator=(const bad_exception& other);
47 };
48
49 void unexpected();
50 typedef void (*unexpected_handler)();
51 typedef void (*terminate_handler)();
52
53 #if CPPREFERENCE_STDVER>= 2011
54 typedef void* exception_ptr; // actually unspecified
55 #endif // CPPREFERENCE_STDVER>= 2011
56
57 bool uncaught_exception();
58 #if CPPREFERENCE_STDVER>= 2017
59 int uncaught_exceptions();
60 #endif
61
62 #if CPPREFERENCE_STDVER>= 2011
63 template<class E>
64 std::exception_ptr make_exception_ptr(E e);
65 std::exception_ptr current_exception();
66 template<class T>
67 void throw_with_nested(T&& t);
68 template<class E>
69 void rethrow_if_nested(const E& e);
70 #endif
71
72 void terminate();
73 #if CPPREFERENCE_STDVER>= 2011
74 std::terminate_handler get_terminate();
75 std::unexpected_handler get_unexpected();
76 #endif
77 std::terminate_handler set_terminate(std::terminate_handler f);
78 std::unexpected_handler set_unexpected(std::unexpected_handler f);
79
80 } // namespace std
81
82 #endif // CPPREFERENCE_EXCEPTION_H
83