YSTest: any.cpp 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

any.cpp
浏览该文件的文档.
1 /*
2 © 2012-2016, 2018 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #include "ystdex/any.h" // for default_init;
29
30 namespace ystdex
31 {
32
33 namespace any_ops
34 {
35
36 holder::~holder() = default;
37
38 } // namespace any_ops;
39
40
41 bad_any_cast::~bad_any_cast() = default;
42
43 const char*
44 bad_any_cast::from() const ynothrow
45 {
46 return
47 from_type() == ystdex::type_id<void>() ? "unknown" : from_type().name();
48 }
49
50 const char*
51 bad_any_cast::to() const ynothrow
52 {
53 return to_type() == ystdex::type_id<void>() ? "unknown" : to_type().name();
54 }
55
56 const char*
57 bad_any_cast::what() const ynothrow
58 {
59 return "Failed conversion: any_cast.";
60 }
61
62 } // namespace ystdex;
63
ystdex::bad_any_cast::to
const char * to() const
Definition: any.cpp:51
ystdex::bad_any_cast::what
virtual const char * what() const override
Definition: any.cpp:57
ystdex::any_ops
Definition: any.h:68
any.h
动态泛型类型。
ystdex::bad_any_cast::from_type
const type_info & from_type() const
Definition: any.h:1123
ystdex::bad_any_cast::to_type
const type_info & to_type() const
Definition: any.h:1133
ystdex
<memory> 特性测试宏。
Definition: ydef.h:1262
ystdex::bad_any_cast::~bad_any_cast
~bad_any_cast() override
虚析构：类定义外默认实现。
ystdex::bad_any_cast::from
const char * from() const
Definition: any.cpp:44
const
const Decapsulate const Decapsulate &y ynothrow ContextNode &ctx const
Definition: NPLA1Forms.cpp:1629
ystdex::any_ops::holder::~holder
virtual ~holder()
虚析构：类定义外默认实现。
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:1199