|
| MSTL_NODISCARD constexpr bool | operator== (const T &rhs) const noexcept(noexcept(derived()==rhs)) |
| | 相等比较运算符
|
| MSTL_NODISCARD constexpr bool | operator!= (const T &rhs) const noexcept(noexcept(!(*this==rhs))) |
| | 不等比较运算符
|
| MSTL_NODISCARD constexpr bool | operator< (const T &rhs) const noexcept(noexcept(derived()< rhs)) |
| | 小于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator> (const T &rhs) const noexcept(noexcept(rhs< derived())) |
| | 大于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator<= (const T &rhs) const noexcept(noexcept(!(derived() > rhs))) |
| | 小于等于比较运算符
|
| MSTL_NODISCARD constexpr bool | operator>= (const T &rhs) const noexcept(noexcept(!(derived()< rhs))) |
| | 大于等于比较运算符
|
template<typename T>
struct icomparable< T >
可比较对象接口模板
- 模板参数
-
通过CRTP模式实现,派生类只需实现operator ==和operator <两个基本比较操作, 即可自动获得所有比较运算符的完整实现。
在文件 icommon.hpp 第 67 行定义.