When should I use raw pointers over smart pointers?

后端 未结 8 1450
礼貌的吻别
礼貌的吻别 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 03:02

    It is true. I can not see the benefits of raw pointers over smart pointers, especially in a complex project.

    For tempory and lightweight usage, raw pointers are fine though.

提交回复
热议问题