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>, ...
随机推荐
- SharePoint 事件 7363:对象缓存:缓存使用的超级读者帐户没有足够的权限访问SharePoint数据库。
转自MSND:http://technet.microsoft.com/zh-cn/library/ff758656(v=office.14) 对象缓存存储 Microsoft SharePoint ...
- Dev使用技巧汇总
C# XtraGrid的行指示器(RowIndicator)行号以及图标设置 参考网址:https://www.cnblogs.com/xuliangxing/p/6775438.html DateE ...
- Chrome Postman及Firefox Poster使用
Chrome浏览器跟Postman工具共用代理设置及Cookie Firefox浏览器跟Poster工具共用代理设置及Cookie xdebug调试原理 第一次请求url通过参数XDEBUG_SE ...
- vertex shader(1)
Vertex shader Architecture: 所有在vertex shader中的数据都用128-bit的quad-floats表示(4x32-bit). vertex shader线性地执 ...
- python---webbrowser模块的使用,用非系统默认浏览器打开
webbrowser模块常用的方法有: webbrowser.open(url, new=0, autoraise=True) 在系统的默认浏览器中访问url地址,如果new=0,url会在同一个浏览 ...
- Excel另存为_有些Excel打开时会出现一些提示
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...
- MySQL数据库篇之存储引擎
主要内容: 一.数据引擎 二.MySQL支持的存储引擎 三.使用存储引擎 1️⃣ 什么是存储引擎? MySQL中建立的库----> 文件夹,库中建立的表----->文件. 现实生活中我们用 ...
- Spark internal - 多样化的运行模式(上)
Spark的运行模式多种多样,在单机上既可以以本地模式运行,也可以以伪分布式模式运行.而当以分布式的方式运行在Cluster集群中时,底层的资源调度可以使用Mesos 或者是Hadoop Yarn , ...
- Ros学习——Cmakelists.txt文件解读
1.过程 .Required CMake Version (cmake_minimum_required) //CMake 需要的版本 .Package Name (project()) //#定义工 ...
- android-tip-关于SurfaceView的使用
1. SurfaceView的创建和销毁 当SurfaceView隐藏时,SurfaceView被销毁,此时会调用SurfaceHolder.Callback.surfaceDestroyed ...