I have a const char* str and i wanted to convert it to a simple string so i used the std::string() constructor and copied the value of str into my variable.
const char* str;
std::string newStr = std::string(str);
<some processing>...
<end>
So before the end of the function do i have to delete the string newStr or the destructor of std::string class is called automatically and this newStr will be deleted. I am confused as i read here that the destructor of std::string class is not virtual. But here it says that the string will be deleted as it goes out of scope. Can anyone throw some light on it as it seems confusing if the destructor is not virtual, how come the string variable gets deleted after it goes out of scope.