Why Qt does not use smart pointers?
Does anyone know why does Qt not use smart pointers at all? For example, QObject could use shared pointers to store children and weak pointers to reference its parent.
Well, Qt does use smart pointers such as "QScopedPointer":http://qt-project.org/doc/qt-5.0/qtcore/qscopedpointer.html
"QSharedPointer":http://qt-project.org/doc/qt-5.0/qtcore/qsharedpointer.html and "QWeakPointer":http://qt-project.org/doc/qt-5.0/qtcore/qweakpointer.html
[edit, typing errors corrected, koahnig]
I know those classes, but Qt itself doesn't really use it AFAIK. For instance, QObject for parent/children, QListWidgetItem, etc, don't use smart pointers.
OK, sorry, I understood your question differently.
There has been a similar discussion lately here on devnet, but i do not know how to find.
For sure I cannot answer this question satisfactorily. AFAIK the overall design concept is different. That has been good enough for me so far :)
do you actually miss it?
I think it works well without them also. And using smart pointers for all pointers would also come with extra cost of operating penalty.
Why Qt doesn't use smart pointers? Because it doesn't need to. Smart pointers are useful for shared objects, or to ensure destruction. Because a QObject (or an item in a view) can have only one parent, there is no sharing. For the same reason, the destruction can be done by the parent without using "complex" tools like smart pointers.
Just by curiosity, why are you asking?