scoped_refptr, unique_ptr的各种用法

一、scoped_refptr
二、unique_ptr

一、scoped_refptr
scoped_refptr 是 Chromium 项目中用于管理内存的一种类型,它是一种引用计数智能指针,用于指向对象。下面是 scoped_refptr 的几种常见用法:

创建 scoped_refptr 对象:

class MyObject {
   
    
    };
scoped_refptr<MyObject> object = new MyObject();

获取原始指针:

MyObject* raw_ptr =

猜你喜欢

转载自blog.csdn.net/weixin_43466192/article/details/128642110