对于常见仿函数的各种类型,是否有普遍接受的术语?C++函数对象术语仿函数,deltor,比较器等
比如我发现自己自然地使用比较比较函子是这样的:
struct ciLessLibC : public std::binary_function<std::string, std::string, bool> {
bool operator()(const std::string &lhs, const std::string &rhs) const {
return strcasecmp(lhs.c_str(), rhs.c_str()) < 0 ? 1 : 0;
}
};
或者使用术语deltor这样的事情:
struct DeleteAddrInfo {
void operator()(const addr_map_t::value_type &pr) const {
freeaddrinfo(pr.second);
}
};
如果使用这类速记术语是常见的,它有一些字典,他们都在哪里?
我所知道的肯定是没有英文单词'comparitor',有'比较'这个词。 – bobah 2010-06-10 08:13:53
我会非正式地称你的“deltor”为“删除者”。 – peterchen 2010-06-10 08:25:52
@bobah:真的,只需编辑帖子来纠正拼写错误,不要评论它。 – 2010-06-10 09:00:37