I have a QMap
with key QString
and with the value myClass
. I've looked through the Qt documentation and decided to define value as pointer to myClass
object. But, I'm puzzled with issue of how to remove
both key and (pointer object allocated by new operator) value? In case, if I used remove() method, would that be safe in terms of memory release of dynamically allocated object?
Is this a good alternative?
myClass *type = types.take("foo");
delete type;