vendredi 2 juillet 2021

Does std::string move assignment causes memory leak

Does the below program has memory leak ?

main()
{
std::string DD("paramhansa");
std::string SS("yogananda");

DD = std::move(SS);
}

Please consider string is large enough to be stored in heap.

What happened to the memory pointed by DD ? Is it destroyed in the move assignment ? Is this a memory leak ?

Aucun commentaire:

Enregistrer un commentaire