2016年10月29日

删除map容器中指定的元素

摘要: for (std::map<Int64,Int64>::iterator iter = ips_forbidden_.begin(); iter != ips_forbidden_.end();) { if (cur_time >= iter->second) { ips_forbidden_.er 阅读全文

posted @ 2016-10-29 17:51 tomcao 阅读(4591) 评论(0) 推荐(0) 编辑

operator++()和operator++(int)的区别

摘要: // 前缀形式:增加然后取回值UPInt& UPInt::operator++(){ *this += 1; // 增加 return *this; // 取回值}// postfix form: fetch and incrementconst UPInt UPInt::operator++(in 阅读全文

posted @ 2016-10-29 17:46 tomcao 阅读(1009) 评论(0) 推荐(2) 编辑

正确使用stl map的erase方法

摘要: 先声明:下面的文章是针对windows的用法,因为std::map的erase函数的windows的实现版本是返回一个std::map的迭代器,但是STL标准里面的该函数的返回值确是: map.erase有3个重载:void erase ( iterator position );size_type 阅读全文

posted @ 2016-10-29 17:43 tomcao 阅读(15974) 评论(0) 推荐(1) 编辑

导航