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>, ...
随机推荐
- python学习笔记(十四): unittest
Python中有一个自带的单元测试框架是unittest模块,用它来做单元测试,它里面封装好了一些校验返回的结果方法和一些用例执行前的初始化操作. 在说unittest之前,先说几个概念: TestC ...
- 【转】Android编码规范建议18条
转自:http://www.chinaz.com/design/2015/0908/443732.shtml Android编码规范建议18条 适合手机app设计师和android 工程师阅读. 1. ...
- 初始mysql语句
操作文件夹(库) 增 : create database db1 charset utf8; 查 : #查看当前创建的数据库 show create database db1; #查看所有的数据库 s ...
- leetcode704
public class Solution { public int Search(int[] nums, int target) { var len = nums.Length; ; ; if (t ...
- Python中的列表生成式和多层表达式
Python中的列表生成式和多层表达式 如何生成[1x1, 2x2, 3x3, ..., 10x10]的列表? L=[]; ,): L.append(x*x) print L print (" ...
- Spring 学习记录7 初识XmlWebApplicationContext
主题 之前Spring相关的一些类,比如Enviromnent,BenFactory都接触了一些.有一些收获.但是直接看代码很多方法都不知为什么这样写.哪里会用到.因为太底层了.不好理解..现在从高层 ...
- linux服务器中Apache隐藏index.php失败
可以通过URL重写隐藏应用的入口文件index.php,下面是相关服务器的配置参考: [Apache] httpd.conf配置文件中加载了mod_rewrite.so模块 AllowOverride ...
- fdsf
https://blog.csdn.net/chen_2890/article/details/83757022Elasticsearch环境搭建和介绍(Windows) https://blog.c ...
- unity配置最簡單程序
using System;using System.Collections.Generic;using System.Linq;using System.Text;using Microsoft.Pr ...
- 用django框架开发一个B2C购物网站用户注册知识点总结2
一:用户部分: 用户注册: 用户注册序列化器: import re from django_redis import get_redis_connection from rest_framework ...