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

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

  •  
  •   wohenfuyou · 2021 年 1 月 11 日 · 2555 次点击
    这是一个创建于 1828 天前的主题,其中的信息可能已经有所发展或是发生改变。

    /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 年 1 月 11 日
    不是 NULL,是 nullptr
    wohenfuyou
        2
    wohenfuyou  
    OP
       2021 年 1 月 11 日
    @wutiantong 我得编译器不支持 nullptr,请问有其他方法么
    HannibaI
        3
    HannibaI  
       2021 年 1 月 11 日
    shared_ptr::reset()
    exiledkingcc
        4
    exiledkingcc  
       2021 年 1 月 11 日
    {}
    wutiantong
        5
    wutiantong  
       2021 年 1 月 11 日
    @wohenfuyou 其他方法就是楼上那样的,也就是 boost::shared_ptr<ControlArea>()
    wohenfuyou
        6
    wohenfuyou  
    OP
       2021 年 1 月 11 日
    好的 谢谢大家
    6ufq0VLZn0DDkL80
        7
    6ufq0VLZn0DDkL80  
       2021 年 1 月 12 日
    clang 3.0/gcc 4.6 就支持 nullptr 了,这得是多老的编译器。。。
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   5498 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 06:37 · PVG 14:37 · LAX 22:37 · JFK 01:37
    ♥ Do have faith in what you're doing.