
boost
xuhao_xuhao
这个作者很懒,什么都没留下…
展开
-
Boost智能指针——scoped_ptr
Boost智能指针——scoped_ptr boost::scoped_ptr和std::auto_ptr非常类似,是一个简单的智能指针,它能够保证在离开作用域后对象被自动释放。下列代码演示了该指针的基本应用: #include #include #include class implementation { public:转载 2014-12-21 22:41:34 · 333 阅读 · 0 评论 -
boost::implicit_cast
boost::implicit_cast 在stackoverflow上看到这个帖子, 于是发现了boost::implicit_cast这个小东西. 先来看看这段代码: struct top {}; struct mid_a : top {}; struct mid_b : top {}; struct bottom : mid_a, mid_b {}; void foo(m转载 2014-12-17 23:23:47 · 490 阅读 · 0 评论 -
Boost学习笔记 BOOST_STATIC_ASSERT
Boost学习笔记 BOOST_STATIC_ASSERT Boost中提供了一个编译时断言宏BOOST_STATIC_ASSERT,这个宏很简单,但里面也有一些值得学习的地方。 首先来看看真正做事的代码 template bool x> struct STATIC_ASSERTION_FAILURE; template struct STATIC_ASSERT转载 2014-12-17 23:05:09 · 655 阅读 · 0 评论 -
Linux中安装boost库详解
Linux中安装boost库详解 2012-05-24 14:31:08| 分类: linux | 标签: |举报 |字号大中小 订阅 来自:http://apps.hi.baidu.com/share/detail/58570207 boost作为一个准标准库,在C++大型项目中经常要用到。在Linux中安装和配转载 2014-11-28 00:39:25 · 1075 阅读 · 0 评论 -
boost::shared_ptr 分析与实现
http://blog.chinaunix.net/u/14337/showart_299314.html /************************************************************ * file: shared_ptr * * desc: 本文将对boost::shared_ptr作一详细的介绍。 本文介绍的转载 2014-09-27 19:22:35 · 412 阅读 · 0 评论 -
Boost智能指针——weak_ptr
Boost智能指针——weak_ptr 循环引用: 引用计数是一种便利的内存管理机制,但它有一个很大的缺点,那就是不能管理循环引用的对象。一个简单的例子如下: #include #include #include #include class parent; class children; typedef boost::shared_转载 2015-01-03 15:15:32 · 304 阅读 · 0 评论 -
为什么多线程读写 shared_ptr 要加锁?
为什么多线程读写 shared_ptr 要加锁? 陈硕(giantchen_AT_gmail_DOT_com) 2012-01-28 最新版下载:http://chenshuo.googlecode.com/files/CppEngineering.pdf 我在《Linux 多线程服务端编程:使用 muduo C++ 网络库》第 1.9 节“再论 shared_ptr 的线转载 2015-01-03 16:12:20 · 471 阅读 · 0 评论 -
boost bind初步探究
最近对boost的bind部分比较感兴趣,对其背后的机制进行了简单的分析,和大家分享一下。 注,我所看的代码是boost_1_51_0, 想来各个版本的差异不大。 从一个例子开始 直接上代码(从官方网站摘取) 定义函数 [cpp] view plaincopyprint? int f(int a, int b) { retur转载 2015-02-27 23:09:14 · 452 阅读 · 0 评论