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>, ...
随机推荐
- mysql清理连接
关闭指定ip的连接: for i in $(mysql -uusername -ppassword -Bse "select * from information_schema.proces ...
- OD 实验(十二) - 对一个 Delphi 程序的逆向
程序: 运行程序 界面显示的是未注册 点击 Help -> About 点击 Use Reg Key 这里输入注册码 用 PEiD 看一下 该程序是用 Delphi 6.0 - 7.0 写的 逆 ...
- C#命名规则和风格(收集)
1. 文件命名组织 1-1文件命名 1. 文件名遵从Pascal命名法,无特殊情况,扩展名小写. 2. 使用统一而又通用的文件扩展名: C# 类 .cs 1-2文件 ...
- 个人关于python装饰器的白痴理解
无参数装饰器 对于python小白来说,python的装饰器简直让人懵逼,不知如何理解,其实按照装饰器的字面意思, 就是把自己定义的函数装饰一遍,然后返回一个新的函数(注意是新的,已经不是本来定义的函 ...
- halcon采集一幅图像
**顺序也很重要,必须现有窗口,才能设置属性 dev_close_window()dev_open_window (0, 0, 1400, 1200, 'black', WindowHandle)de ...
- leetcode8
public class Solution { public int MyAtoi(string str) { , sign = , total = ; //1. Empty string ) { ; ...
- MySQL学习笔记之二---引擎介绍MyISAM VS InnoDB
前言 MyISAM是MySQL的默认数据库引擎(5.5版之前),由早期的ISAM(Indexed Sequential Access Method:有索引的顺序访问方法)所改良.虽然性能极佳,但却有一 ...
- git如何处理别人的pull request及解决冲突 (转)
原贴地址 出过两次了,每次都查很多资料,太蛋疼,记录在此. 当你的项目比较牛逼的时候,有人给你贡献代码,但他修改的地方恰恰你前阵子也修改了,这样在github中就不能够自动merge了. 因此你需要手 ...
- 前端开发之CSS篇三
主要内容: 一.CSS布局之浮动 二.清除浮动带来的问题 三.margin塌陷问题和水平居中 四.善用父级的的padding取代子级的margin 五.文本属性和字体 ...
- 行走于Swift的世界中(转)
从Swift正式公布到现在,我基本一直在关注和摸索Swift.对于一门新语言来说,开荒阶段的探索自然是激动人心的,但是很多时候,资料的缺失和细节的隐藏也让人着实苦恼.最近几天的感受是,Swift 并不 ...