标准库标头 <exception>

来自cppreference.com
< cpp‎ | header


 
 
标准库头
 

此头文件是错误处理库的一部分。

目录

标准库组件抛出的各种异常的基类
(类)[编辑]
捕获并存储当前异常的混入类型
(类)[编辑]
std::current_exception 无法复制异常对象时抛出的异常
(类)[编辑]
(C++11 弃用)(C++17 移除)
std::unexpected 所调用的函数类型
(typedef)[编辑]
std::terminate 所调用的函数类型
(typedef)[编辑]
处理异常对象的共享指针类型
(typedef)[编辑]

函数

(C++11 弃用)(C++17 移除)
违背动态异常说明时调用的函数
(函数)[编辑]
(C++20 中移除*)(C++17)
检查当前是否正在进行异常处理
(函数)[编辑]
从异常对象创建一个std::exception_ptr
(函数模板)[编辑]
捕获当前异常到 std::exception_ptr 之中
(函数)[编辑]
从一个 std::exception_ptr 抛出异常
(函数)[编辑]
抛出实参,带上混入的 std::nested_exception
(函数模板)[编辑]
抛出 std::nested_exception 中的异常
(函数模板)[编辑]
异常处理失败时调用的函数
(函数)[编辑]
获得当前的 terminate_handler
(函数)[编辑]
更改将被 std::terminate 调用的函数
(函数)[编辑]
(C++11 弃用)(C++17 移除)
获得当前的 unexpected_handler
(函数)[编辑]
(C++11 弃用)(C++17 移除)
更改要被 std::unexpected 调用的函数
(函数)[编辑]

[编辑]概要

namespace std {class exception;class bad_exception;class nested_exception;   using terminate_handler =void(*)(); terminate_handler get_terminate()noexcept; terminate_handler set_terminate(terminate_handler f)noexcept;[[noreturn]]void terminate()noexcept;   int uncaught_exceptions()noexcept;   using exception_ptr =/* 未指明 */;   exception_ptr current_exception()noexcept;[[noreturn]]void rethrow_exception(exception_ptr p);template<class E> exception_ptr make_exception_ptr(E e)noexcept;   template<class T>[[noreturn]]void throw_with_nested(T&& t);template<class E>void rethrow_if_nested(const E& e);}

[编辑]std::exception

namespace std {class exception {public: exception()noexcept; exception(const exception&)noexcept; exception& operator=(const exception&)noexcept;virtual ~exception();virtualconstchar* what()constnoexcept;};}

[编辑]std::bad_exception

namespace std {class bad_exception :public exception {public:// 特殊成员函数的规定见 [exception]constchar* what()constnoexcept override;};}

[编辑]std::nested_exception

namespace std {class nested_exception {public: nested_exception()noexcept; nested_exception(const nested_exception&)noexcept=default; nested_exception& operator=(const nested_exception&)noexcept=default;virtual ~nested_exception()=default;   // 访问函数[[noreturn]]void rethrow_nested()const; exception_ptr nested_ptr()constnoexcept;};   template<class T>[[noreturn]]void throw_with_nested(T&& t);template<class E>void rethrow_if_nested(const E& e);}

[编辑]参阅

close