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

Binary Predicate

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
xyz 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的更多相关文章

  1. c++ stl sort 自定义排序函数cmp要遵循 strict weak ordering

    满足strict weak ordering的运算符能够表达其他所有的逻辑运算符(logical operator): <(a, b)  : (a < b) <=(a, b): !( ...

  2. strict weak ordering导致公司级故障

    大家好,我是雨乐! 前段时间,某个同事找我倾诉,说是因为strict weak ordering导致程序coredump,给公司造成数百万损失,最终评级故障为P0级,年终奖都有点不保了,听完不禁一阵唏 ...

  3. C++ std::set

    std::set template < class T, // set::key_type/value_type class Compare = less<T>, // set::k ...

  4. C++ std::priority_queue

    std::priority_queue template <class T, class Container = vector<T>, class Compare = less< ...

  5. C++ std::multimap

    std::multimap template < class Key, // multimap::key_type class T, // multimap::mapped_type class ...

  6. C++ std::map

    std::map template < class Key, // map::key_type class T, // map::mapped_type class Compare = less ...

  7. STL heap usage

    简介 heap有查找时间复杂度O(1),查找.插入.删除时间复杂度为O(logN)的特性,STL中heap相关的操作如下: make_heap() push_heap() pop_heap() sor ...

  8. C++ Tips and Tricks

    整理了下在C++工程代码中遇到的技巧与建议. 0x00 巧用宏定义. 经常看见程序员用 enum 值,打印调试信息的时候又想打印数字对应的字符意思.见过有人写这样的代码 if(today == MON ...

  9. C++ std::multiset

    std::multiset template < class T, // multiset::key_type/value_type class Compare = less<T>, ...

随机推荐

  1. OD 实验(十九) - 对多态和变形程序的逆向

    程序: 这个窗口显示这是一个需要去除的 Nag 窗口 点击“确定” 用 PEiD 看一下 这是一个用汇编语言写的程序 逆向: 用 OD 载入程序 Nag 窗口的标题和文本 右键 -> 查找 -& ...

  2. centos 6.3 kickstart 装机卡在 unsupported hardware detected 页面

    起因 最近厂里一批 dell 新机器 centos 6.3 装机卡在 Unsupported Hardware Detected 页面,要人肉点击 OK 才能继续装机: Unsupported Har ...

  3. git之项目上传

    git之项目上传 需求:将项目代码上传至github 前期准备: 1.github账号注册 2.安装git环境,可以打开且使用git shell. 3.生成SSH key并与github账号绑定 步骤 ...

  4. 「小程序JAVA实战」小程序的基础组件(24)

    转自:https://idig8.com/2018/08/12/xiaochengxu-chuji-24/ 来说下 ,小程序的基础组件.源码:https://github.com/limingios/ ...

  5. tomcat的配置文件server.conf中的元素的理解

    tomcat的配置文件server.conf中的元素的理解 tomcat作为一个servlet服务器本身的配置文件是tomcat_home/conf/server.conf,这个配置文件中有很多元素, ...

  6. 网络编程基础之Socket套接字简单应用

    一.Socket套接字实现通信循环 所谓通信循环,简单理解就是客户端可以给服务端循环发送信息并获得反馈的过程. 1.基础版 通信循环的程序分为两部分,即两个python模块,分别为客户端.py和服务端 ...

  7. 混合开发Js bridge新秀-DSBridge iOS篇

    这个DSBridge 和我之前开发做的混合开发 用的方式 很相似,所以觉得很是不错,推荐给你大家. DSBridge-IOS:https://github.com/wendux/DSBridge-IO ...

  8. VMWare windows找不到microsoft软件许可条款

    提示如下错误: windows找不到microsoft软件许可条款.请确保安装源有效,然后重新启动安装. 解决方案: 把该虚拟机中的系统硬件配置中的软盘去掉. 程序员的基础教程:菜鸟程序员

  9. 利用django中间件CsrfViewMiddleware防止csrf攻击

    一.在django后台处理 1.将django的setting中的加入django.contrib.messages.middleware.MessageMiddleware,一般新建的django项 ...

  10. Redis清理

    Redis登录: Redis目录: redis-cli.exe -h 127.0.0.1 -p 6739 login:  auth “password”      flushall