Strict Weak Ordering
Description
A Strict Weak Ordering is a Binary Predicate that compares two objects, returning true if the first precedes the second. This predicate must satisfy the standard mathematical definition of a strict weak ordering. The precise requirements are stated below, but what they roughly mean is that a Strict Weak Ordering has to behave the way that "less than" behaves: if a is less than b then b is not less than a, if a is less than b and b is less than c then a is less than c, and so on.
严格偏序集=二元关系集+二元关系的反自反性+二元关系的传递性+二元关系的反对称性。
Refinement of
Associated types
| First argument type | The type of the Strict Weak Ordering's first argument. |
| Second argument type | The type of the Strict Weak Ordering's second argument. The first argument type and second argument type must be the same. |
| Result type | The type returned when the Strict Weak Ordering is called. The result type must be convertible to bool. |
Notation
| F | A type that is a model of Strict Weak Ordering |
| X | The type of Strict Weak Ordering's arguments. |
| f | Object of type F |
| x, y, z | Object of type X |
Definitions
- Two objects x and y are equivalent if both f(x, y) and f(y, x) are false. Note that an object is always (by the irreflexivity invariant) equivalent to itself.
Valid expressions
None, except for those defined in the
Binary Predicate
requirements.
Expression semantics
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Function call | f(x, y) | The ordered pair (x,y) is in the domain of f | Returns true if x precedes y, and false otherwise | The result is either true or false |
Complexity guarantees
Invariants
| Irreflexivity | f(x, x) must be false. |
| Antisymmetry | f(x, y) implies !f(y, x) |
| Transitivity | f(x, y) and f(y, z) imply f(x, z). |
| Transitivity of equivalence | Equivalence (as defined above) is transitive: if x is equivalent to y and y is equivalent to z, then x is equivalent to z. (This implies that equivalence does in fact satisfy the mathematical definition of an equivalence relation.) [1] |
Models
Notes
[1] The first three axioms, irreflexivity, antisymmetry, and transitivity, are the definition of a partial ordering; transitivity of equivalence is required by the definition of a strict weak ordering. A total ordering is one that satisfies an even stronger condition: equivalence must be the same as equality.
Strict Weak Ordering的更多相关文章
- c++ stl sort 自定义排序函数cmp要遵循 strict weak ordering
满足strict weak ordering的运算符能够表达其他所有的逻辑运算符(logical operator): <(a, b) : (a < b) <=(a, b): !( ...
- strict weak ordering导致公司级故障
大家好,我是雨乐! 前段时间,某个同事找我倾诉,说是因为strict weak ordering导致程序coredump,给公司造成数百万损失,最终评级故障为P0级,年终奖都有点不保了,听完不禁一阵唏 ...
- C++ std::set
std::set template < class T, // set::key_type/value_type class Compare = less<T>, // set::k ...
- C++ std::priority_queue
std::priority_queue template <class T, class Container = vector<T>, class Compare = less< ...
- C++ std::multimap
std::multimap template < class Key, // multimap::key_type class T, // multimap::mapped_type class ...
- C++ std::map
std::map template < class Key, // map::key_type class T, // map::mapped_type class Compare = less ...
- STL heap usage
简介 heap有查找时间复杂度O(1),查找.插入.删除时间复杂度为O(logN)的特性,STL中heap相关的操作如下: make_heap() push_heap() pop_heap() sor ...
- C++ Tips and Tricks
整理了下在C++工程代码中遇到的技巧与建议. 0x00 巧用宏定义. 经常看见程序员用 enum 值,打印调试信息的时候又想打印数字对应的字符意思.见过有人写这样的代码 if(today == MON ...
- C++ std::multiset
std::multiset template < class T, // multiset::key_type/value_type class Compare = less<T>, ...
随机推荐
- thinkphp5的程序部署到虚拟主机的配置
thinkphp5的程序部署到虚拟主机的配置 建议不要,因为这些目录文件会全部保留,那么没办法的时候咋整 1 htdocs 虚拟主机上的 把public/index.php修改 改动后的放到 ht ...
- http协议及web框架
http协议简介 HTTP协议是Hyper Text Transfer Protocol(超文本传输协议)的缩写,是用于万维网(WWW:World Wide Web )服务器与本地浏览器之间传输超文本 ...
- VUE 初步学习
Vue 简单的总结一 Vue 简单的总结二 Vue 简单的总结三 Vue 简单的总结四(项目流程) Vue 简单的总结五 Vue(6)- Vue-router进阶.单页面应用(SPA)带来的问题 Vu ...
- C# 生成序号不足补0
int Num=13 var code =Num.ToString().PadLeft(4, '0'); code:0013
- 3.Redis 数据类型
转自:http://www.runoob.com/redis/redis-tutorial.html Redis支持五种数据类型:string(字符串),hash(哈希),list(列表),set(集 ...
- js 的eval()方法 计算某个字符串,并执行其中的的 JavaScript 代码;
定义和用法 eval() 函数可计算某个字符串,并执行其中的的 JavaScript 代码. 语法 eval(string) 参数 描述 string 必需.要计算的字符串,其中含有要计算的 Java ...
- 使用AddressSanitizer做内存分析(一)——入门篇
使用AddressSanitizer做内存分析 新建文件mem_leak.cpp,键入代码: #include <iostream> int main() { ]; p = NULL; ; ...
- Perl 子程序(函数)
1.Perl 子程序(函数)Perl 子程序也就是用户定义的函数.Perl 子程序即执行一个特殊任务的一段分离的代码,它可以使减少重复代码且使程序易读. Perl 子程序可以出现在程序的任何地方,语法 ...
- Android APK反编译就这么简单 详解
在学习Android开发的过程你,你往往会去借鉴别人的应用是怎么开发的,那些漂亮的动画和精致的布局可能会让你爱不释手,作为一个开发者,你可能会很想知道这些效果界面是怎么去实现的,这时,你便可以对改应用 ...
- p4688 [Ynoi2016]掉进兔子洞
传送门 分析 我们考虑先将所有数离散化 之后我们对于每个状态用一个bitset来记录 其中第i段表示颜色i的信息 对于每一段信息均是段首若干1,剩余若干0表示这种颜色有多少个 于是我们不难想到莫队 答 ...