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. ubuntu下用expect实现密码自动输入

    每次笔记本一开机启动,总会连用不着且碍事的触摸板也一块启动.便想写个脚本,让电脑启动时关闭触摸板.(当然,我想更好的办法是,修改系统启动时的加载模块,让触摸板不自动加载,但是目前还不知道用这种方法怎么 ...

  2. JavaScript知识总结--对象的相关概念

    一.定义 无序属性的集合. 说白了就是一个容器,可以容纳[基本值.对象或者函数],这些东西都叫做属性.每个属性都有一个名字,每个名字都映射一个值(可以是基本类型的值,也可以是引用类型的值).从以上描述 ...

  3. leetcode382

    /** * Definition for singly-linked list. * public class ListNode { * public int val; * public ListNo ...

  4. leetcode566

    public class Solution { public int[,] MatrixReshape(int[,] nums, int r, int c) { ); ); if (row * col ...

  5. ajax 回调函数

    回调函数 如果要处理$.ajax()得到的数据,则需要使用回调函数.beforeSend.error.dataFilter.success.complete. beforeSend 在发送请求之前调用 ...

  6. IDEA2018.2版本注册

    IntelliJ IDEA 2018.2版本注册 1.到官网下载IDEA安装文件,windows版本ideaIU-2018.2.2.exe,然后安装: 2.下载补丁包JetbrainsCrack-3. ...

  7. Django 获取时间 和Linux 本地 系统时间 不一致

    问题描述 Django 中获取的本地时间 ,和系统时间不一致 错误原因 Django在配置文件settings.py 中 默认配置 UTC世界标准时间,而北京时间是东八区,比UTC时间早8个小时. T ...

  8. 第1章WCF简介(WCF全面解析读书笔记2)

    第1章 WCF简介 面向服务架构(SOA)是近年来备受业界关注的一个主题,它代表了软件架构的一种方向.顺应SOA发展潮流,微软于2006年年底推出了一种新的分布式通信框架Windows Communi ...

  9. C#路径的相关操作

    1.判定一个给定的C#路径是否有效,合法 通过Path.GetInvalidPathChars或Path.GetInvalidFileNameChars方法获得非法的C#路径/文件名字符,可以根据它来 ...

  10. 微服务性能优化之thrift改造

    在我当前所做的web项目中,采用前后端分离模式前端通过Django 提供restful接口,后端采用微服务架构,微服务之间的调用采用jsonrpc,由于微服务之间的调用很频繁,导致前端得到的响应很慢, ...