c++11 智能指针删除器
来源:互联网 发布:java 复制文件夹 编辑:程序博客网 时间:2024/06/02 06:31
其实很简单自己上代码:
#include <string>#include <stdio.h>#include <iostream>#include <malloc.h>#include <memory>using namespace std;struct struct_s{ int i;}; void delete_struct(struct_s* p){ printf("hehe\n"); free(p); p=NULL;}void fun(){ struct_s* t = (struct_s*)malloc(sizeof(struct_s)); shared_ptr<struct_s> sp(t ,delete_struct); //删除器可以改变share_ptr销毁对象行为}int main(){ printf("main in\n"); fun(); printf("fun call\n"); return 0;}
0 0
- c++11 智能指针删除器
- 【C++】智能指针shared_ptr 定位删除器(仿函数)
- C++:Boost库智能指针_删除器
- c++:智能指针
- C++:智能指针
- 【C++】智能指针
- 【C++】智能指针
- C++PJ智能指针
- 【c++】智能指针
- 【C++】智能指针auto_ptr
- C++,智能指针
- C++,boost智能指针
- 智能指针模拟C
- [C++]智能指针
- 【C++】 浅析智能指针
- C++_智能指针
- C++:初识智能指针
- C++::智能指针
- iOS 关于邮件发送的三种方法
- 百度2017暑期实习生编程题:单词接龙
- 文本处理(python)
- Android ListView 头部缩小放大的效果
- 比较全面的gdb调试命令
- c++11 智能指针删除器
- java面试题(7.22)
- 50.Which two statements are true about alerts? (Choose two.)
- eMMC分区详解
- 使用MKDocs构建Markdown格式API文档(macOS)
- 暑假集训--训练2 DFS
- CSS 选择器
- SplitContainer控件扩展之收缩面板
- 3288/3188项目