Details
-
Epic
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
QT_NO_SCOPED_POINTER
Description
QScopedPointer has a weird protocol (cleanup() instead of operator()()), weird semantics (swap(), take(), contradicting the "scoped" part, but no move SMFs, so can't be held in containers, cf. e.g. QTBUG-48744), and can't handle stateful deleters.
std::unique_ptr can do all of the above, and act as a scoped pointer, if marked as const (as QSopedPointer needs to be, to disable take() and swap()).
Add an opt-out macro, QT_NO_SCOPED_POINTER, make QtCore headers compile with it, and then roll it out across the code base, eventually making it the default for each module, and then all modules, centrally.
When replacing QScopedPointer<C>, consider not only std::unique_ptr<C>, but also std::optional<C>.
Attachments
Issue Links
- is required for
-
QTBUG-132242 [Initiative] Phase out bad Qt API
- Open