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

2021-01-11 14:20:43 +08:00
 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 是个类

2014 次点击
所在节点    C++
7 条回复
wutiantong
2021-01-11 14:59:39 +08:00
不是 NULL,是 nullptr
wohenfuyou
2021-01-11 15:14:07 +08:00
@wutiantong 我得编译器不支持 nullptr,请问有其他方法么
HannibaI
2021-01-11 15:25:36 +08:00
shared_ptr::reset()
exiledkingcc
2021-01-11 15:28:47 +08:00
{}
wutiantong
2021-01-11 16:27:10 +08:00
@wohenfuyou 其他方法就是楼上那样的,也就是 boost::shared_ptr<ControlArea>()
wohenfuyou
2021-01-11 17:01:49 +08:00
好的 谢谢大家
cholerae
2021-01-12 12:11:16 +08:00
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