仿函数
来源:互联网 发布:api接口 聚合数据 编辑:程序博客网 时间:2024/05/16 19:38
/*
重载operator()
*/
#include<iostream>using namespace std;template<class T>struct Plus{ T operator()(const T &x,const T &y)const { return x+y; }};template<class T>struct Minus{ T operator()(const T &x,const T &y)const { return x-y; }};int main(void){ Plus<int> PlusInt; Minus<int> MinusInt; cout<<PlusInt(5,9)<<endl; cout<<MinusInt(2,19)<<endl; cout<<Plus<int>()(42,50)<<endl; cout<<Minus<int>()(43,50)<<endl; return 0;}
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- UVa Problem 10084 Hotter Colder (冷热游戏)
- Custom Database Integration Guide Of Openfire
- 什么是Kernel、Shell、Bash 很幽默的解释
- UVa Problem 10065 Useless Tile Packers (没用的瓷砖打包公司)
- 美国驻华大使骆家辉在北京外国语大学的演讲
- 仿函数
- IO笔记
- Swing笔记
- 电脑知识:Win7中的库是什么,以及关闭和开启库的办法
- 如何有效实现软件的需求管理 - 3
- WCF服务在IIS7.0中用WAS托管
- ADA程序实例(一个简单的智能指针实现)
- android+unity游戏开发之求物体间的距离
- 寻址过程