当前位置:网站首页>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边栏推荐
猜你喜欢
随机推荐
洛谷P2245 星际导航
MQ框架应用比较
02.折叠隐藏文字
洛谷P6586 蒟蒻火锅的盛宴
jwsManager服务接口实现类-jni实现
嵌入式分享合集33
【服务器安装mysql】centos7下使用mysql离线安装包安装mysql5.7
关于数据分页显示
[Actual combat scene] Mall-discount event design plan
Overview of the JVM garbage collection and mechanism
ERROR: Could not install packages due to an OSError: [Errno 2] 没有那个文件或目录: ‘/data/xxxx
关于pom.xml文件
在 关闭页面/卸载(unload)文档 之前向服务器发送请求
洛谷P1196 银河英雄传说
自研能力再获认可,腾讯云数据库入选 Forrester Translytical 报告
增加PRODUCT_BOOT_JARS及类 提供jar包给应用
Embedded Sharing Collection 33
「转」“搜索”的原理,架构,实现,实践,面试不用再怕了
map和set--天然的搜索和查找语义
网络技能树









