【转】浅析auto_ptr(7)
时间:2025-07-14
时间:2025-07-14
智能指针,auto_prt的基本用法,及其示例
auto_ptr的使用及其源码注释
/**
Module Name:main.cpp
Description:
继承标准异常类创建了自己的异常类CatException
创建一个类Cat
使用了auto_ptr模板
Author:Harite.K@
Created:MinGW32_3.4.4 && C-Free4.0beta1
Last Change:2006/09/17
*/
#include <memory>
#include <string>
#include <cstring>
#include <iostream>
#include <exception>
#include <cstdio>
using namespace std;
//异常类
class CatException : public exception
{
public:
CatException(const string& errormsg) throw()
{
__errormsg = errormsg;
}
~CatException() throw()
{
}
const char* what() const throw()
{
return __errormsg.c_str();
上一篇:预分解窑操作的体会(二)