boost::shared_ptr相关
来源:互联网 发布:opencv调用tensorflow 编辑:程序博客网 时间:2024/06/14 22:10
看到代码里有MyCls类和MyClsPtr类,一直以为MyClsPtr类是由boost根据MyCls类自动生成的,谁知道它是需要typedef一下才行的。
#include <boost/shared_ptr.hpp>class MyCls{public: MyCls(int i = 0, float f = 0) :i_(i), f_(f){}public: int i_; float f_;};typedef boost::shared_ptr<MyCls> MyClsPtr;//只有typedef了MyClsPtr后,才能使用MyClsPtr。我一直以为是自动生成的MyClsPtr呢。-_-!int main(){ MyClsPtr ptr = MyClsPtr(new MyCls(3, 1.732f)); ptr->i_ = 2; ptr->f_ = 1.414f; MyClsPtr ptr2 = ptr; return 0;}
另外,
完。
0 0
- boost::shared_ptr相关
- boost>shared_ptr
- Boost - shared_ptr
- boost>shared_ptr
- boost>shared_ptr
- boost::shared_ptr
- boost::shared_ptr
- boost>shared_ptr
- boost::shared_ptr
- boost::shared_ptr boost::make_shared
- about boost::shared_ptr
- boost shared_ptr用法
- boost 中的 shared_ptr
- boost/shared_ptr 用法总结
- boost shared_ptr用法
- Boost学习--初窥shared_ptr
- Boost学习--再窥shared_ptr
- boost::shared_ptr是个好东西
- 链表中倒数第k个结点
- 取出json解析出来的对象列表的元素时报错java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be
- NSScanner类的基本用法
- java基础第四天——数组
- Java之数据类型、变量和数组
- boost::shared_ptr相关
- java中的原子类
- [leetcode 28] Implement strStr()
- 《剑指offer》——左旋转字符串
- 单例的创建
- Unity3D 关于Coroutine(协程)使用的研究笔记及关于yield的理解
- 删除数据时的提示效果
- 反转链表
- 47.沙盒机制(简单对象的写入)