摘要: 本文介绍通过stl的map和set来实现的排序和踢重,对于简单的数据类型,比如说int和long等,由于可以直接比较大小,所以可以直接作为map的键和set的值,而对于class类型的数据,则不能直接作为map的键和set的值,需要对小于号的操作符进行重载。stl中的string也是数据class类型的数据,stl本身重载了小于号,这点可以从stl的源码中查看:// operator inline bool operator& __lhs, const basic_string& __rhs) { return __lhs.compare(__... 阅读全文
posted @ 2014-04-02 14:15 xiaomengaliang 阅读(478) 评论(0) 推荐(0) 编辑
摘要: 先看代码 #include #include #include using namespace std; static pthread_mutex_t m_cMutex = PTHREAD_MUTEX_INITIALIZER; static int __number = 0; static pthread_t __thread_id = 0;void * timeout_monitor(void * args){ cout ==== ********timeout_monitor begin ******** ========" ==== ******... 阅读全文
posted @ 2014-04-02 11:38 xiaomengaliang 阅读(639) 评论(0) 推荐(0) 编辑