码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2019-01-10 18:49:48      阅读:636      评论:0      收藏:0      [点我收藏+]

标签:逻辑运算   sort   html   logical   str   ring   sdn   使用   csdn   

   满足strict weak ordering的运算符能够表达其他所有的逻辑运算符(logical operator):

  • <(a, b)  : (a < b)
  • <=(a, b): !(b < a)
  • ==(a, b): !(a < b) && !(b < a)
  • !=(a, b) : (a < b) || (b < a)
  • >(a, b)  : (b < a)
  • >=(a, b): !(a < b)

引用自https://www.cnblogs.com/walkerlala/p/5561339.html

当使用>=或者<=的情况可能产生RE,参见https://blog.csdn.net/tanjinjun2011/article/details/33844357 

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

标签:逻辑运算   sort   html   logical   str   ring   sdn   使用   csdn   

原文地址:https://www.cnblogs.com/pengpenggege/p/10251682.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!