码迷,mamicode.com
首页 >  
搜索关键字:5 c++ boost 智能指针    ( 2698个结果
【C++】智能指针auto_ptr的简单实现
//【C++】智能指针auto_ptr的简单实现 #include using namespace std; template class auto_ptr { public: auto_ptr(_Ty *_P = 0) :_Owns(_Ptr != 0), _Ptr(_P) {} auto_ptr(const auto_ptr &p):_Owns(p._Owns),_Ptr(...
分类:编程语言   时间:2015-06-05 17:32:36    阅读次数:135
Mitsuba中的智能指针ref<>和scheduler单例
Mitsuba中随处可见ref 和 scheduler先说说class ref, 它在include\mitsuba\core\ref.h中定义templateclass ref{public: /// Create a NULL reference ref() : m_ptr(NULL...
分类:其他好文   时间:2015-06-05 17:22:02    阅读次数:117
Android设计模式--代理模式
1、定义: 为其他对象提供一种代理以控制对这个对象的访问。 2、使用: 在某些情况下,一个对象不适合或者不能直接引用另一个对象,而代理对象可以在客户端和目标对象之间起到中介的作用。 3、作用: 代理对象可以在客户端和目标对象之间起到中介的作用,这样起到了的作用和保护了目标对象的作用。 4、划分: 代理还分成远程代理、虚代理、保护代理和智能指针; 以下写了一个简单的demo;...
分类:移动开发   时间:2015-06-04 09:45:53    阅读次数:159
ACE智能指针
Bound_Ptr.h 1 // -*- C++ -*- 2 3 //============================================================================= 4 /** 5 * @file Bound_Ptr....
分类:其他好文   时间:2015-06-04 00:56:05    阅读次数:270
boost的原子操作
[cpp] view plaincopy int a=0;   std::cout boost::thread t1([&](){              for (int cnt=0;cnt     {           a+=1;       }      });   boost::thread t2([&](){       for (...
分类:其他好文   时间:2015-06-03 17:48:18    阅读次数:426
auto_ptr和shared_ptr
《Effective C++》在资源管理一节提到了智能指针,智能指针中最著名的当属auto_ptr和shared_ptr。本文主要研究两者的实现。auto_ptr的实现:templateclass auto_ptr{private: T *ap;public: explicit au...
分类:其他好文   时间:2015-06-03 17:35:48    阅读次数:116
25 Killer Actions to Boost Your Self-Confidence
25 Killer Actions to Boost Your Self-Confidence
分类:其他好文   时间:2015-06-03 11:43:31    阅读次数:172
安装boost库
1. 下载boost库        http://www.boost.org/users/download/ 2. 解压boost_1_58_0.tar.gz 文件             tar -xzvf  boost_1_58_0.tar.gz    3. 解压后,进入boost_1_53_0目录,执行:./bootstrap.sh 4. 执行: ./b2 5. ...
分类:其他好文   时间:2015-06-02 15:25:14    阅读次数:105
C++细节学习之智能指针auto_ptr和tr1::shared_ptr
为什么要用智能指针? 我们知道在C++中,资源管理是个头疼的问题。资源管理最常做的就是内存管理。而指针用起来如果忘记归还,就会导致内存泄露。 比如:class Oneclass{}; int func(){ Oneclass* one=new Oneclass; if(!one)return 1; delete one; return 0; }可见,上面代码中,我...
分类:编程语言   时间:2015-06-02 09:29:59    阅读次数:138
program_options禁止命令行短参数
典型的 boost program_options的用法如下:#include using namespace boost::program_options;using namespace std;int main(int argc, char* argv[]) // 需要命令行参数{ int .....
分类:其他好文   时间:2015-05-31 16:37:02    阅读次数:127
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!