3 ms·
Not really, deleteLater() will simply delete a QObject at the end of the event loop - and since QObjects have an integrated for of unique_ptr, it will delete it
by lultimouomo 10y ago
Not really, deleteLater() will simply delete a QObject at the end of the event loop - and since QObjects have an integrated for of unique_ptr, it will delete its whole object graph with it.
deferred_ptr is more of a memory region together with a form of integrated GC - it will collect unused object (even if they're part of object cycles) and destroy them when you run collect().
With QObject, you need to call deleteLater() to get rid of each object, and the "later" part only guarantees you that you won't have crashes if the object is still involved in slot calls.
With deferred_ptr, you only call collect() on the deferred_heap when it suits you, and it will take care of deleting unused objects.