摘要: 众所周知,map有find,但vector的find只能调用algorithm中的find通用方法。参考《How to find an item in a std::vector?》对于结构体来说,如何定义==呢?想到了重载==操作符,通常的情形是重载相同类型,在例子中,我重载了int类型的。结果也过了,感觉很请强大,具体参考如下代价#include #include using namespace std;struct ReaderInfo { int key; size_t value; bool operator == (const ReaderInfo& other) cons 阅读全文
posted @ 2014-02-24 19:29 westfly 阅读(856) 评论(0) 推荐(0) 编辑