std::bad_any_cast
成员函数 | ||||
修改器 | ||||
观察器 | ||||
非成员函数 | ||||
在标头
<any>
定义
|
||
class
bad_any_cast :
public
std::bad_cast;
|
(C++17 起) | |
定义 std::any_cast 在失败时以值返回形式抛出的对象的类型。
成员函数
(构造函数)
|
构造新的 bad_any_cast 对象 (公开成员函数) |
operator=
|
替换 bad_any_cast 对象 (公开成员函数) |
what
|
返回解释字符串 (公开成员函数) |
std::bad_any_cast::bad_any_cast
bad_any_cast()
noexcept;
|
(1) | (C++17 起) |
bad_any_cast(
const
bad_any_cast&
other )
noexcept;
|
(2) | (C++17 起) |
构造新的拥有实现定义的空终止字节字符串的 bad_any_cast
对象,字符串能通过 what() 访问。
参数
other | - | 要复制的另一异常对象 |
std::bad_any_cast::operator=
bad_any_cast&
operator=(
const
bad_any_cast&
other )
noexcept;
|
(C++17 起) | |
以 other
的内容赋值。如果 *this 与
other
均拥有动态类型 std::bad_any_cast
,那么赋值后 std::strcmp(what(), other.what()) == 0。
参数
other | - | 用来赋值的另一异常对象 |
返回值
*this
std::bad_any_cast::what
virtual
const
char*
what()
const
noexcept;
|
(C++17 起) | |
返回解释字符串。
参数
(无)
返回值
指向有解释信息的空终止字符串的指针。该字符串适合转换并显示为 std::wstring。保证该指针至少到获得它来源的异常对象被销毁,或在该异常对象上调用非 const 成员函数(例如复制赋值运算符)为止合法。
注解
允许但不要求实现覆写 what()
。
继承自 std::bad_cast
继承自 std::exception
成员函数
[虚]
|
析构该异常对象 ( std::exception
的虚公开成员函数) |
[虚]
|
返回解释性字符串 ( std::exception
的虚公开成员函数) |