Is it possible to introduce Automatic Reference Counting (ARC) to C++?

前端 未结 9 675
时光取名叫无心
时光取名叫无心 2021-02-04 01:54

Objective C has introduced a technology called ARC to free the developer from the burden of memory management. It sounds great, I think C++ developers would be very happy if g++

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 02:09

    There's no need. We have shared pointers that do this for us. In fact, we have a range of pointer types for a variety of different circumstances, but shared pointers mimic exactly what ARC is doing.

    See:

    std::shared_ptr<>

    boost::shared_ptr<>

提交回复
热议问题