当前位置:网站首页>智能指针笔记
智能指针笔记
2022-08-11 04:44:00 【Ingsuifon】
shared_pointer
Aliasing
shared_poiner 可以和另一个指针共享所有权,但是它实际指向的却是不同对象。
即拥有的对象和指向的对象不是同一物。
//aliasing constructor
template<class Y>
shared_ptr(const shared_ptr<Y>& r, element_type* ptr) noexcept;
class Foo {
public:
Foo(int value) : m_data {
value} {
}
int m_data;
};
auto foo {
make_shared<Foo>(42) };
auto aliasing {
shared_ptr<int> {
foo, &foo->m_data } };
//aliasing和foo共同拥有对Foo对象的所有权,但aliasing指向的是它的成员变量
边栏推荐
- 【服务器安装Redis】Centos7离线安装redis
- 分层架构&SOA架构
- 直播软件搭建,流式布局,支持单选、多选等
- Self-research capability was recognized again, and Tencent Cloud Database was included in the Forrester Translytical report
- Overview of the JVM garbage collection and mechanism
- 交换机和路由器技术-34-动态NAT
- Mysql: set the primary key to automatically increase the starting value
- Layered Architecture & SOA Architecture
- 交换机和路由器技术-36-端口镜像
- .NET service registration
猜你喜欢
findViewById返回null的问题
破解事务性工作瓶颈,君子签电子合同释放HR“源动力”!
洛谷P2150 寿司晚宴
简历里写了会代码,却依然过不了面试这一关
Embedded Sharing Collection 33
交换机和路由器技术-36-端口镜像
Do you understand how the Selenium automated testing framework works?
北湖区燕泉街道开展“戴头盔·保安全”送头盔活动
Where can machine learning be applied?What is machine learning useful for?
ALSA音频架构
随机推荐
Jetson Orin平台4-16路 GMSL2/GSML1相机采集套件推荐
JVM 垃圾回收的概述与机制
1815. Get the maximum number of groups of fresh donuts state compression
The principle, architecture, implementation, practice of "transfer" and "search", no need to be afraid of interviews
洛谷P2580 于是他错误的点名开始了
【ImageNet】数据集1000个类的名称
快速使用UE4制作”大场景游戏“
源代码加密技术浅析
视觉任务种常用的类别文件之一json文件
洛谷P7441 Erinnerung
洛谷P2245 星际导航
0 Basic software test for career change, self-study for 3 months, 12k*13 salary offer
The priority queue
MQ框架应用比较
干货:服务器网卡组技术原理与实践
二叉堆的基础~
洛谷P4324 扭动的回文串
如何给网页添加icon图标?
【组成原理 九 CPU】
Dry goods: The principle and practice of server network card group technology