greater和less是xfunctional.h中的两个结构体,代码如下:

 template<class _Ty = void>
struct less
{ // functor for operator<
typedef _Ty first_argument_type;
typedef _Ty second_argument_type;
typedef bool result_type; constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator< to operands
return (_Left < _Right);
}
};
 template<class _Ty = void>
struct greater
{ // functor for operator>
typedef _Ty first_argument_type;
typedef _Ty second_argument_type;
typedef bool result_type; constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator> to operands
return (_Left > _Right);
}
};

greater表示内置类型从大到小排序,less表示内置类型从小到大排序。

C++:greater<int>和less<int>的更多相关文章

  1. Convert.ToInt32()、int.Parse()和(int)三者的区别

    Convert.ToInt32将object类类型转换成int类型,如Convert.ToInt32(session["shuzi"]); (int)适合简单数据类型之间的转换: ...

  2. 深度解析C语言int与unsigned int

    就如同int a:一样,int 也能被其它的修饰符修饰.除void类型外,基本数据类型之前都可以加各种类型修饰符,类型修饰符有如下四种:1.signed----有符号,可修饰char.int.Int是 ...

  3. C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别

    转自:http://www.cnblogs.com/leolis/p/3968943.html 在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为 整型(int)来讲, ...

  4. what is difference in (int)a,(int&)a,&a,int(&a) ?

    This interview question come from a famous communication firm of china. : ) #include <iostream> ...

  5. int(3)和int(10)的区别

    int(M) 在 integer 数据类型中,M 表示最大显示宽度.在 int(M) 中,M 的值跟 int(M) 所占多少存储空间并无任何关系. int(3).int(4).int(8) 在磁盘上都 ...

  6. C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别 <转>

    作者:Statmoon 出处:http://leolis.cnblogs.com/   在编程过程中,数据转换是经常要用到的,C#中数据转换的方法很多,拿将目标对象转换为整型(int)来讲,有四种方法 ...

  7. 【C】二级指针探秘 & 星号的两种用法(1.与基本类型结合形成另一种类型,比如与int结合形成int* 2.取值操作)

    1)问题:二级指针到底是什么?怎么用的?怎么存放的? #include <stdio.h> #define TEST_ADDR 0x12FF40 void main() { int a = ...

  8. int.Parse()、int.TryParse()和Convert.ToInt32()的区别

    1:int.Parse(一个参数)        此参数必须满足: 1 只能是字符串: 2 只能是 “整型” 字符串,即各种整型ToString()之后的形式,也不能为浮点型. 2:int.TryPa ...

  9. (int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别

    C#中(int).int.Parse().int.TryParse()和Convert.ToInt32()的区别   原文链接:http://www.cnblogs.com/leolis/p/3968 ...

  10. Java-集合-第三题 有如下Student 对象, private String name; private int age; private int score; private String classNum; 其中,classNum 表示学生的班号,例如“class05”。 有如下List List list = new ArrayList(); l

    第三题 有如下Student 对象, private String name; private int age; private int score; private String classNum; ...

随机推荐

  1. 【洛谷P5020】货币系统 完全背包

    题目大意:给定 N 个数,求在这 N 个数中至少选出几个数能表示出所有数字,输出最少的个数. 题解:由于只有小的数字可以表示大的数字,因此首先需要对这 N 个数字进行从小到大排序.排序之后就变成一道不 ...

  2. (转)使用 Spring缓存抽象 支持 EhCache 和 Redis 混合部署

    背景:最近项目组在开发本地缓存,其中用到了redis和ehcache,但是在使用注解过程中发现两者会出现冲突,这里给出解决两者冲突的具体方案. spring-ehcache.xml配置: <?x ...

  3. logging模块(二十六)

    用于便捷记录日志且线程安全的模块 可在logging.basicConfig()函数中通过具体参数来更改logging模块默认行为,可用参数有 filename:用指定的文件名创建FiledHandl ...

  4. 利用千人基因组数据库查看SNP在不同地区、国家、洲的频率及个数

    首先,进入千人基因组数据库的网站:https://www.ncbi.nlm.nih.gov/variation/tools/1000genomes/ 如下图所示,在数据库的框框里输入我们感兴趣的SNP ...

  5. 2018.9青岛网络预选赛(H)

    传送门:Problem H https://www.cnblogs.com/violet-acmer/p/9664805.html 题意: BaoBao在一条有刻度的路上行走(哈哈,搞笑),范围为 [ ...

  6. 【清北学堂2018-刷题冲刺】Contest 9

     前几天本蒟蒻一直在颓废所以这篇题解咕了很久,而且最后一个题目不太会,最终也没完成,非常惭愧.  写这些题目收获相当大.后面的日子呢,我会继续着手刷NOIP题目和Codeforces题目.  到这里就 ...

  7. Kubernetes Pv & Pvc

    Kubernetes PV & pvc 介绍 PersistentVolume(pv)和PersistentVolumeClaim(pvc)是k8s提供的两种API资源,用于抽象存储细节.管理 ...

  8. 2范数和F范数的区别

    2范数和F范数是不同的. 2范数表示矩阵或向量的最大奇异值,max⁡(svd(X)) 而 F范数表示矩阵所有元素平方和的开方根 sqrt(∑_(x_(i,j∈X))▒x_(i,j)^2 )

  9. DOJO常用的函数

    DOJO常用的: 1,通过dojo.require以类似C编程中#include或者Java中import的方式加载所需的部件如dojo.require("dojo.parser" ...

  10. 函数和常用模块【day06】:hashlib模块(十三)

    本节内容 1.简述 2.加密 3.sha1加密 4.sha256加密 5.sha384加密 6.sha512加密 7.hmac加密 一.简述 我们写程序中,经常需要对字符串进行MD5加密,python ...