当前位置:网站首页>智能指针笔记
智能指针笔记
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指向的是它的成员变量
边栏推荐
- Use Navicat Premium to export database table structure information to Excel
- 利用Navicat Premium导出数据库表结构信息至Excel
- 每日一题-滑动窗口
- 华南师范宋宇老师课堂对话论文翻译
- Mysql中事件和定时任务
- 如何给网页添加icon图标?
- vector中resize() 用法排坑
- 洛谷P2150 寿司晚宴
- 洛谷P6586 蒟蒻火锅的盛宴
- Clang Code Model: Error: The clangbackend executable “X:/clangbackend.exe“ could not be started
猜你喜欢

ALSA音频架构 -- snd_pcm_open函数分析

交换机和路由器技术-28-OSPF的NSSA区域

Get Qt installation information: including installation directory and various macro addresses

交换机和路由器技术-31-扩展ACL

对象的创建以及显示转换

交换机和路由器技术-24-OSPF单区域配置

0 Basic software test for career change, self-study for 3 months, 12k*13 salary offer

剑指offer_抽象建模能力

Dry goods: The principle and practice of server network card group technology

简历里写了会代码,却依然过不了面试这一关
随机推荐
关于数据分页显示
Use Navicat Premium to export database table structure information to Excel
The basics of binary heap~
【服务器安装Redis】Centos7离线安装redis
如何缓解压力、拒绝内耗【1】
Do you understand how the Selenium automated testing framework works?
leetcode 9. 回文数
交换机和路由器技术-32-命名ACL
es-head plugin insert query and conditional query (5)
Application of Identification Cryptography in IMS Network
1815. 得到新鲜甜甜圈的最多组数 状态压缩
洛谷P4324 扭动的回文串
堆排序 和冒泡排序
【FPGA教程案例50】控制案例2——基于FPGA的PD控制器verilog实现
嵌入式分享合集33
使用百度EasyDL实现施工人员安全装备检测
快速使用UE4制作”大场景游戏“
洛谷P4560 Wall 砖墙
[Server installation Redis] Centos7 offline installation of redis
【FPGA教程案例49】控制案例1——基于FPGA的PID控制器verilog实现