std::make_exception_ptr
来自cppreference.com
在标头 <exception> 定义
|
||
template< class E > std::exception_ptr make_exception_ptr( E e ) noexcept; |
(C++11 起) (C++26 起为 constexpr) |
|
创建一个保有到 e 副本的引用的 std::exception_ptr。这如同执行下列代码:
try { throw e; } catch(...) { return std::current_exception(); }
目录 |
[编辑] 参数
e | - | 要创建对其副本的引用的异常对象 |
[编辑] 返回值
std::exception_ptr 实例,它保有到 e
副本,或到 std::bad_alloc 实例,或到 std::bad_exception 实例的引用(参阅 std::current_exception)。
[编辑] 注解
参数按值传递,并受切片影响。
功能特性测试宏 | 值 | 标准 | 功能特性 |
---|---|---|---|
__cpp_lib_constexpr_exceptions |
202411L |
(C++26) | constexpr 的异常类型 |
[编辑] 示例
本节未完成 原因:暂无示例 |
[编辑] 参阅
(C++11) |
捕获当前异常到 std::exception_ptr 之中 (函数) |