wohenfuyou
V2EX  ›  C++

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

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