QScopedPointer uses delete []
Solved
General and Desktop
-
Why
QScopedPointer
usesdelete []
instead of simpledelete
?template <typename T> struct QScopedPointerArrayDeleter { static inline void cleanup(T *pointer) { // Enforce a complete type. // If you get a compile error here, read the section on forward declared // classes in the QScopedPointer documentation. typedef char IsIncompleteType[ sizeof(T) ? 1 : -1 ]; (void) sizeof(IsIncompleteType); delete [] pointer; } };
-
http://doc.qt.io/qt-5/qscopedpointer.html#custom-cleanup-handlers
You chose what to use by specifying the second template argument.
QScopedPointer<int>
usesdelete
QScopedPointer<int,QScopedPointerArrayDeleter>
usesdelete []