Google C++ Style Guidegoes out of scope. It cannot be copied, but can be moved to represent owner- ship transfer. std::shared_ptr is a smart pointer type that expresses shared ownership of a dynamically allocated object. std::shared_ptrs ownership of the object is shared among all copies, and the object is deleted when the last std::shared_ptr is destroyed. • It’s virtually impossible to manage dynamically allocated memory without some if the performance benefits are significant, and the underlying object is im- mutable (i.e. std::shared_ptr). If you do use shared ownership, prefer to use std::shared_ptr. Do not use scoped_ptr 0 码力 | 83 页 | 238.71 KB | 1 年前3
共 1 条
- 1













