内建函数对象意义
概念:
STL内建了一些函数对象
分类:
算术仿函数
关系仿函数
逻辑仿函数
用法:
这些仿函数所产生的对象,用法和一般函数完全相同使用内建函数对象,需要引入头文件 #include<functional>
#include <iostream>
#include <functional>
using namespace std
;
void test01()
{
negate
<int> n
;
cout
<< n(50) << endl
;
}
void test02()
{
plus
<int> p
;
cout
<< p(10, 20) << endl
;
}
int main()
{
test01();
test02();
return 0;
}
转载请注明原文地址:https://tech.qufami.com/read-28613.html