c++智能指针,new之后不需要delete,简单的垃圾回收

http://www.cnblogs.com/TenosDoIt/p/3456704.html

智能指针的初始化:

错误:

std::shared_ptr<Serializer> serializerObj2(new Serializer)

正确:

std::shared_ptr<Serializer> serializerObj2 = new Serializer;

std::shared_ptr<Serializer> serializerObj2{new Serializer};
原文地址:https://www.cnblogs.com/zealousness/p/9572006.html