2008年12月10日

About functor (仿函数)

摘要: 仿函数其实很简单,就是在类中重载括号操作符,然后对象就可以以括号的方式调用,如同一个函数调用: template class op_add { public: _Ty operator()(_Ty& a,_Ty& b) { return a+b; } }; stl 中有很多典型示例。 阅读全文

posted @ 2008-12-10 09:55 cgwolver 阅读(247) 评论(0) 推荐(0)

导航