2 //===--------------------------- stdexcept --------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef _LIBCPP_STDEXCEPT
12 #define _LIBCPP_STDEXCEPT
22 class invalid_argument;
28 class underflow_error;
30 for each class xxx_error:
32 class xxx_error : public exception // at least indirectly
35 explicit xxx_error(const string& what_arg);
36 explicit xxx_error(const char* what_arg);
38 virtual const char* what() const noexcept // returns what_arg
47 #include <iosfwd> // for string forward decl
49 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
50 #pragma GCC system_header
53 namespace std // purposefully not using versioning namespace
56 class _LIBCPP_EXCEPTION_ABI logic_error
62 explicit logic_error(const string&);
63 explicit logic_error(const char*);
65 logic_error(const logic_error&) _NOEXCEPT;
66 logic_error& operator=(const logic_error&) _NOEXCEPT;
68 virtual ~logic_error() _NOEXCEPT;
70 virtual const char* what() const _NOEXCEPT;
73 class _LIBCPP_EXCEPTION_ABI runtime_error
79 explicit runtime_error(const string&);
80 explicit runtime_error(const char*);
82 runtime_error(const runtime_error&) _NOEXCEPT;
83 runtime_error& operator=(const runtime_error&) _NOEXCEPT;
85 virtual ~runtime_error() _NOEXCEPT;
87 virtual const char* what() const _NOEXCEPT;
90 class _LIBCPP_EXCEPTION_ABI domain_error
94 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
95 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
97 virtual ~domain_error() _NOEXCEPT;
100 class _LIBCPP_EXCEPTION_ABI invalid_argument
104 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
105 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
107 virtual ~invalid_argument() _NOEXCEPT;
110 class _LIBCPP_EXCEPTION_ABI length_error
114 _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
115 _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
117 virtual ~length_error() _NOEXCEPT;
120 class _LIBCPP_EXCEPTION_ABI out_of_range
124 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
125 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
127 virtual ~out_of_range() _NOEXCEPT;
130 class _LIBCPP_EXCEPTION_ABI range_error
131 : public runtime_error
134 _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
135 _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
137 virtual ~range_error() _NOEXCEPT;
140 class _LIBCPP_EXCEPTION_ABI overflow_error
141 : public runtime_error
144 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
145 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
147 virtual ~overflow_error() _NOEXCEPT;
150 class _LIBCPP_EXCEPTION_ABI underflow_error
151 : public runtime_error
154 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
155 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
157 virtual ~underflow_error() _NOEXCEPT;
162 #endif // _LIBCPP_STDEXCEPT