请问大家, boost::shared_ptr 无法赋值为 null 么

2021 年 1 月 11 日
 wohenfuyou

/home/d5000/kedong/src/app/xcp_container/src/PModelContainer.cpp:34: 错误:对 ‘ControlArea::setParentControlArea(NULL)’ 的调用没有匹配的函数
/home/d5000/kedong/src/app/xcp_container/include/ControlArea.h:25: 附注:备选为:void ControlArea::setParentControlArea(boost::shared_ptr<ControlArea>)

以上是编译错误
ControlArea 是个类

2710 次点击
所在节点    C++
7 条回复
wutiantong
2021 年 1 月 11 日
不是 NULL,是 nullptr
wohenfuyou
2021 年 1 月 11 日
@wutiantong 我得编译器不支持 nullptr,请问有其他方法么
HannibaI
2021 年 1 月 11 日
shared_ptr::reset()
exiledkingcc
2021 年 1 月 11 日
{}
wutiantong
2021 年 1 月 11 日
@wohenfuyou 其他方法就是楼上那样的,也就是 boost::shared_ptr<ControlArea>()
wohenfuyou
2021 年 1 月 11 日
好的 谢谢大家
6ufq0VLZn0DDkL80
2021 年 1 月 12 日
clang 3.0/gcc 4.6 就支持 nullptr 了,这得是多老的编译器。。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/743822

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX