YSTest: examiner.hpp 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

examiner.hpp
浏览该文件的文档.
1 /*
2 © 2012-2013, 2015-2016 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 #ifndef YB_INC_ystdex_examiner_hpp_
29 #define YB_INC_ystdex_examiner_hpp_ 1
30
31 #include "type_op.hpp" // for ynoexcept_spec, yimpl, enable_if_t,
32 // has_equality_operator;
33
34 namespace ystdex
35 {
36
41 namespace examiners
42 {
43
48 struct equal
49 {
51 template<typename _type1, typename _type2>
52 static yconstfn YB_PURE auto
53 are_equal(_type1&& x, _type2&& y)
54 ynoexcept_spec(bool(x == y)) -> decltype(bool(x == y))
55 {
56 return bool(x == y);
57 }
58 };
59
60
65 struct always_equal
66 {
68 template<typename _type, typename _type2, yimpl(typename
69 = enable_if_t<!has_equality_operator<_type&&, _type2&&>::value>)>
70 static yconstfn YB_STATELESS bool
71 are_equal(_type&&, _type2&&) ynothrow
72 {
73 return true;
74 }
75 };
76
77
82 struct equal_examiner : public equal, public always_equal
83 {
84 using equal::are_equal;
85 using always_equal::are_equal;
86 };
87
88 } // namespace examiners;
89
90 } // namespace ystdex;
91
92 #endif
93
ystdex::examiners::always_equal::are_equal
static bool are_equal(_type &&, _type2 &&)
Definition: examiner.hpp:71
ystdex::has_equality_operator
判断是否存在合式的结果可转换为 bool 类型的 == 操作符接受指定类型的表达式。
Definition: type_op.hpp:199
YSLib::Drawing::x
The boundary is out of the const Rect SDst SPos x
Definition: YDraw.h:127
YB_STATELESS
#define YB_STATELESS
指示函数或函数模板实例为无状态函数。
Definition: ydef.h:522
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:740
ystdex::examiners::equal_examiner
等于操作检测。
Definition: examiner.hpp:82
ystdex::cpp2014::enable_if_t
typename enable_if< _bCond, _type >::type enable_if_t
Definition: type_traits.hpp:350
yimpl
#define yimpl(...)
实现标签。
Definition: ydef.h:256
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:501
ynoexcept_spec
#define ynoexcept_spec(...)
表达式 noexcept 异常规范。
Definition: ydef.h:768
ystdex
特性测试宏。
Definition: ydef.h:796
ystdex::examiners::equal
基本等于操作检测。
Definition: examiner.hpp:48
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
ystdex::examiners::equal::are_equal
static auto are_equal(_type1 &&x, _type2 &&y) -> decltype(bool(x==y))
Definition: examiner.hpp:53
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:654
type_op.hpp
C++ 类型操作。
ystdex::examiners::always_equal
基本等于操作检测：总是相等。
Definition: examiner.hpp:65
platform::bool
std::FILE *fp bool
Definition: FileIO.h:1187