對於常見仿函數的各種類型,是否有普遍接受的術語?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