当前位置:网站首页>Smart Pointer Notes
Smart Pointer Notes
2022-08-11 04:52:00 【Ingsuifon】
shared_pointer
Aliasing
shared_pointer can share ownership with another pointer, but it actually points to a different object.
That is, the owned object and the pointed object are not the same thing.
//aliasing constructortemplate<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 and foo share ownership of the Foo object, but aliasing points to its member variables
边栏推荐
猜你喜欢
The sword refers to offer_abstract modeling capabilities
ALSA音频架构 -- aplay播放流程分析
交换机和路由器技术-26-OSPF末梢区域配置
交换机和路由器技术-22/23-OSPF动态路由协议/链路状态同步过程
2022新员工公司级安全教育基础培训(118页)
0基础转行软件测试,自学3个月,浅拿12k*13薪offer
简历里写了会代码,却依然过不了面试这一关
优化是一种习惯●出发点是“站在靠近临界“的地方
Optimization is a kind of habit low starting point is the "standing near the critical"
交换机和路由器技术-30-标准ACL
随机推荐
堆排序 和冒泡排序
关于pom.xml文件
zabbix构建企业级监控告警平台
【实战场景】商城-折扣活动设计方案
Overview of the JVM garbage collection and mechanism
map and set - natural search and lookup semantics
洛谷P5139 z小f的函数
破解事务性工作瓶颈,君子签电子合同释放HR“源动力”!
To break the bottleneck of transactional work, the gentleman signs the electronic contract to release the "source power" of HR!
力扣——青蛙跳台阶问题
开发工具篇第七讲:阿里云日志查询与分析
Snap - rotate the smallest number of an array
交换机和路由器技术-21-RIP路由协议
交换机和路由器技术-27-OSPF路由重分发
Dry goods: The principle and practice of server network card group technology
Word2021 中的图片保存后就变模糊了
Events and scheduled tasks in Mysql
交换机和路由器技术-33-静态NAT
[Web3 series development tutorial - create your first NFT (9)] How to view your NFT in the mobile wallet
Australia cyberspace security system construction