C++ 11: smart pointers usage [duplicate]
问题 This question already has answers here : Which kind of pointer do I use when? (4 answers) Closed 5 years ago . What are the best practices for using smart. Are there situations in which i should prefer using raw pointer instead of smart pointers? For example, if i know that class A creates class B and is the only owner of B - if there a reason to use smart pointers? If you know of any good articles on that subject, please share. 回答1: If the pointer owns the object at any time, then use a