I want to manage pointer with smart pointer in my code, however I must call old C-style interface to get pointer, like that:
void getPointer(T** pT, int* pSize);
Users pass an empty pointer of Pt and return a pointer, I want to manage it with smart pointer in my code like
std::shared_ptr<T> ptr;
How should I write my code? I have been told that use get() method is not a safe idea. Another question is, how should I safely copy memory stored in smart pointer to a raw pointer? (or vice)
Aucun commentaire:
Enregistrer un commentaire