仿函数(functors)在C++标准中采用的名称是函数对象(function objects),实际上就是函数对象,所谓函数对象就是具有函数性质的对象。仿函数主要用于STL中的算法中。
structObjectEqualFunctor {
booloperator()(const__unsafe_unretainedidleft,
const__unsafe_unretainedidright)const{
returnleft == right;
}
};
(未完待续)
仿函数(functors)在C++标准中采用的名称是函数对象(function objects),实际上就是函数对象,所谓函数对象就是具有函数性质的对象。仿函数主要用于STL中的算法中。
structObjectEqualFunctor {
booloperator()(const__unsafe_unretainedidleft,
const__unsafe_unretainedidright)const{
returnleft == right;
}
};
(未完待续)
本文标题:Functor --- 仿函数
本文链接:https://www.haomeiwen.com/subject/apbknttx.html
网友评论