http://blog.csdn.net/templarzq/article/details/8047154
c++标准不支持模板函数指针,比如:
- template <typename Type>
- typedef int (* Func) (constType& type);//提示编译错误
不过我们可以这样写:
- template<typename COL_TYPE,typename RESULT_TYPE>
- class CAggCalculator {
- private:
- typedef bool (CAggCalculator::* AggFuncT) (CColumnSeg<COL_TYPE>& columnSeg,RESULT_TYPE& result);
- typename CAggCalculator<COL_TYPE,RESULT_TYPE>::AggFuncT m_pAggFuncT;
- .....
- };
这样我们就得到一个指向 bool xxx(CColumnSeg& columnSeg,RESULT_TYPE& result);类型的模板类成员函数了