摘要:
#include using namespace std; typedef struct { char *name; int stuid; int age; }Student; /**************************/ bool cmp(const Student &stua,const Student &stub) { return stua.age>stub.age... 阅读全文
摘要:
一,概述 仿函数(functor),就是使一个类的使用看上去象一个函数。其实现就是类中实现一个operator(),这个类就有了类似函数的行为,就是一个仿函数类了。 有些功能的的代码,会在不同的成员函数中用到,想复用这些代码。 1)公共的函数,可以,这是一个解决方法,不过函数用到的一些变量,就可能成 阅读全文