[SOLVED] Does calling remove() on a QMap call the deleted item's destructor?



  • Topic title says it all. I looked around and couldn't find a clear answer to this simple question.

    I have a QMap<QString, Node *> filled with nodes. When calling

    @QMap<QString, Node *>::remove(node->objectName());@

    will the Node class destructor be called automatically or should I delete the node manually?



  • You will have to destroy "node" yourself. QMap works very much like std::map.



  • Thank you, that's what I thought, but I just wanted to make sure. Just wanted to make sure after I think I read somewhere that it would delete the object by itself.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.