只有一个关于shared_ptr的小问题。
shared_ptr
使用shared_ptr指向数组是一种好的做法吗?例如,
shared_ptr<int> sp(new int[10]);
若否,原因何在?我已经知道的一个原因是不能递增/递减shared_ptr。因此,它不能像普通的数组指针一样使用。
https://stackoverflow.com/questions/13061979
相似问题