06 2018 档案

摘要:1 例子 多线程访问同一资源时,为了保证数据的一致性,必要时需要加锁。 1.1 直接操作 mutex,即直接调用 mutex 的 lock / unlock 函数。 c++ include include include boost::mutex mutex; int count = 0; void 阅读全文
posted @ 2018-06-19 13:12 TuringM 阅读(10230) 评论(0) 推荐(0)
摘要:1.智能指针类型 C++98最早的智能指针auto_ptr已被废止。 C++11/14标准中的unique_ptr、shared_ptr和weak_ptr,源于boost中的scoped_ptr、shared_ptr和weak_ptr(boost中共有6种智能指针) 2.scoped_ptr(sco 阅读全文
posted @ 2018-06-15 18:02 TuringM 阅读(4472) 评论(0) 推荐(0)