智能指针

来源:互联网 发布:scratch趣味编程课程 编辑:程序博客网 时间:2024/04/25 01:19

今天开始写c++ effective的读书笔记。

以对象管理资源需要pointer-like object,即智能指针。

#include "stdafx.h"
#include "iostream"
#include "memory"
 
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
 int* p=new int(12);
 std::auto_ptr<int> pint(p);
 cout<<*pint<<endl;
 cin.get();
 return 0;
}

原创粉丝点击