When should I use raw pointers over smart pointers?

后端 未结 8 1441
礼貌的吻别
礼貌的吻别 2020-11-28 02:49

After reading this answer, it looks like it is a best practice to use smart pointers as much as possible, and to reduce the usage of \"normal\"/raw pointers to minimum.

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 02:58

    I believe smart pointer should be used as much as possible, even in the situation where raw pointer is enough. unique_ptr can help manage the resource life cycle while still staying small and fast. Don't look back!

提交回复
热议问题