Consider this code:
#include <vector>
void Example()
{
std::vector<TCHAR*> list;
TCHAR* pLine = new TCHAR[20];
list.push_back(pLine);
list.clear(); // is delete called here?
// is delete pLine; necessary?
}
Does list.clear()
call delete
on each element? I.e. do I have to free the memory before / after list.clear()
?