V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wohenfuyou
V2EX  ›  C++

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

  •  
  •   wohenfuyou · 2021-01-11 14:20:43 +08:00 · 1987 次点击
    这是一个创建于 1173 天前的主题,其中的信息可能已经有所发展或是发生改变。

    /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 是个类

    7 条回复    2021-01-12 12:11:16 +08:00
    wutiantong
        1
    wutiantong  
       2021-01-11 14:59:39 +08:00
    不是 NULL,是 nullptr
    wohenfuyou
        2
    wohenfuyou  
    OP
       2021-01-11 15:14:07 +08:00
    @wutiantong 我得编译器不支持 nullptr,请问有其他方法么
    HannibaI
        3
    HannibaI  
       2021-01-11 15:25:36 +08:00
    shared_ptr::reset()
    exiledkingcc
        4
    exiledkingcc  
       2021-01-11 15:28:47 +08:00
    {}
    wutiantong
        5
    wutiantong  
       2021-01-11 16:27:10 +08:00
    @wohenfuyou 其他方法就是楼上那样的,也就是 boost::shared_ptr<ControlArea>()
    wohenfuyou
        6
    wohenfuyou  
    OP
       2021-01-11 17:01:49 +08:00
    好的 谢谢大家
    cholerae
        7
    cholerae  
       2021-01-12 12:11:16 +08:00
    clang 3.0/gcc 4.6 就支持 nullptr 了,这得是多老的编译器。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3544 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 10:33 · PVG 18:33 · LAX 03:33 · JFK 06:33
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.