NANA
safememory.hpp
浏览该文件的文档.
1#pragma once
2#include "core_global.h"
17#include <memory>
18
19namespace NANA {
23template<typename _T>
24class Ptr : public std::shared_ptr<_T>
25{
26public:
27
28private:
29
30};
31
32
39template<typename _T>
40inline void deleteSafe(_T*& p) {
41 if (nullptr == p)
42 return;
43 delete p;
44 p = nullptr;
45}
46
47
54template<typename _T>
55inline void deleteArraySafe(_T*& p) {
56 if (nullptr == p)
57 return;
58 delete[] p;
59 p = nullptr;
60}
61
62
63
64}
65
66
继承自std::shared_ptr的智能指针
Definition: safememory.hpp:25
全局头文件
void deleteArraySafe(_T *&p)
deleteArraySafe 安全释放 xxx * a = new xxx[num];申请的内存
Definition: safememory.hpp:55
void deleteSafe(_T *&p)
Definition: safememory.hpp:40