wohenfuyou
V2EX  ›  C++

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

  •  
  •   wohenfuyou · Jan 11, 2021 · 3054 views
    This topic created in 2128 days ago, the information mentioned may be changed or developed.

    /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 replies  •  2021-01-12 12:11:16 +08:00
    wutiantong
    wutiantong
    Jan 11, 2021
    1
    不是 NULL,是 nullptr
    wohenfuyou
    wohenfuyou
    OP
    Jan 11, 2021
    2
    @wutiantong 我得编译器不支持 nullptr,请问有其他方法么
    HannibaI
    HannibaI
    Jan 11, 2021
    3
    shared_ptr::reset()
    exiledkingcc
    exiledkingcc
    Jan 11, 2021
    4
    {}
    wutiantong
    wutiantong
    Jan 11, 2021
    5
    @wohenfuyou 其他方法就是楼上那样的,也就是 boost::shared_ptr<ControlArea>()
    wohenfuyou
    wohenfuyou
    OP
    Jan 11, 2021
    6
    好的 谢谢大家
    6ufq0VLZn0DDkL80
    6ufq0VLZn0DDkL80
    Jan 12, 2021
    7
    clang 3.0/gcc 4.6 就支持 nullptr 了,这得是多老的编译器。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1348 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 17:14 · PVG 01:14 · LAX 09:14 · JFK 12:14
    ♥ Do have faith in what you're doing.