returning a 'pointer' which is required to be held by a smart pointer

后端 未结 3 631
借酒劲吻你
借酒劲吻你 2021-02-02 02:37

I have a project which I would like to make more use of smart pointers. Overall, I have been successful in this goal. However, I\'ve come across one things which I\'m not sure w

3条回答
  •  耶瑟儿~
    2021-02-02 03:06

    With C++11 you should be able to use std::unique_ptr as the other smart pointer types have constructors that take a std::unique_ptr. If you maintain an internal list of such resources then you'd probably want to use std::shared_ptr.

提交回复
热议问题