智能指针
介绍内存管理和智能指针的使用
Jeff1993!
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
5.7返回unique_ptr、删除器、尺寸、智能指针
返回unique_ptr、删除器、尺寸、智能指针unique_ptr使用方法总结和智能指针概述 unique_ptr使用方法总结和智能指针概述 #include<iostream> #include<cstdlib> #include<string> #include<vector> #include <memory> using namespace std; unique_ptr<string>myFunction() { u原创 2020-08-09 19:11:43 · 272 阅读 · 0 评论 -
5.5shared_ptr使用场景、陷阱、性能分析、使用建议
shared_ptr使用场景、陷阱、性能分析、使用建议shared_ptr常用操作与使用陷阱 shared_ptr常用操作与使用陷阱 #include<iostream> #include<cstdlib> #include<string> #include<vector> #include <memory> using namespace std; //测试类 class CT:public enable_shared_from_this&l原创 2020-08-09 16:39:34 · 250 阅读 · 0 评论 -
5.4 weak_ptr概述、weak_ptr常用操作、尺寸
weak_ptr概述、weak_ptr常用操作、尺寸weak_ptr概述 weak_ptr概述 #include<iostream> #include<cstdlib> #include<string> #include<vector> #include <memory> using namespace std; int main(void) { //weak_ptr一般是使用shared_ptr来创建爱女 auto p1 = make_原创 2020-08-09 16:38:14 · 230 阅读 · 0 评论 -
5.3shared_ptr常用操作、计数、自定义删除器等等
shared_ptr常用操作、计数、自定义删除器等等share_ptr的引用和减少与常见操作 share_ptr的引用和减少与常见操作 #include<iostream> #include<cstdlib> #include<string> #include<vector> #include <memory> using namespace std; class A { public: A() {} ~A() { } };原创 2020-08-09 12:48:45 · 237 阅读 · 0 评论 -
5.2new、delete探秘,智能指针概述、shared_ptr
new、delete探秘,智能指针概述、shared_ptrnewdelete探秘new、delete做了什么operator new()和operator delete()基本new如何记录分配的内存大小供delete使用申请和释放一个数组为什么new/delete,new[]/delete[]要配对使用智能指针概述和shared_ptr基础常规初始化make_shared函数 newdelete探秘 new、delete做了什么 operator new()和operator delete() 基本ne原创 2020-08-09 11:12:33 · 316 阅读 · 0 评论 -
5.1内存管理、创建新工程观察内存泄漏
内存管理、创建新工程观察内存泄漏一级目录 一级目录 #include<iostream> #include<cstdlib> #include<string> #include<vector> using namespace std; int main(void) { static int j = 23;//局部静态对象,在静态区分配内存 int i = 10;//由系统进行分配和释放 int *p1 = new int;//动态内存分配,初原创 2020-08-08 22:05:18 · 130 阅读 · 0 评论
分享