08-1.cpp
来自「effective stl 源代码 code」· C++ 代码 · 共 26 行
CPP
26 行
//
// Example from ESTL Item 8
//
#include <iostream>
#include <memory>
#include "ESTLUtil.h"
#include "Widget.h"
int main()
{
using namespace std;
using namespace ESTLUtils;
auto_ptr<Widget> pw1(new Widget); // pw1 points to a Widget
auto_ptr<Widget> pw2(pw1); // pw2 points to pw1抯 Widget;
// pw1 is set to NULL. (Ownership
// of the Widget is transferred
// from pw1 to pw2.)
pw1 = pw2; // pw1 now points to the Widget
// again; pw2 is set to NULL
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?