On Friday, 15 June 2018 00:32:13 PDT Philippe wrote: > QObject has built-in support to a reference count block to support QPointer > (which is composed of a QWeakPointer) > > When doing QSharedPointer<QObject>, is there a technical reason that > prevents the QObject control block to be used, rather allocating a new one, > like it is necessary for common objects?
That's what we did in Qt 4 and that wasn't a good idea. The fact that QPointer uses QSharedPointer's control block is an implementation detail, not to be relied upon. Maybe we could save the extra 16 bytes allocation, but the use of both QSharedPointer and QPointer isn't likely. And for Qt 6, we may reimplement QSharedPointer on top of std::shard_ptr, so this wouldn't be available for long as a feature. > IOW, is a QSharedPointer<QObject> specialization feasible? To do what? -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
