Thursday, 15 August 2013

Should I delete a heap-allocated string after sending it to std::string?

Should I delete a heap-allocated string after sending it to std::string?

Say I have this:
char * p = new char[10];
std::string str = p;
Do I have to delete[] p or does std::string do that for me?

No comments:

Post a Comment