一、scoped_refptr
二、unique_ptr
一、scoped_refptr
scoped_refptr 是 Chromium 项目中用于管理内存的一种类型,它是一种引用计数智能指针,用于指向对象。下面是 scoped_refptr 的几种常见用法:
创建 scoped_refptr 对象:
class MyObject {
};
scoped_refptr<MyObject> object = new MyObject();
获取原始指针:
MyObject* raw_ptr =