Hi all, QSharedData and QImplicitlySharedDataPointer (QISDP) is a common combination used to implement implicit sharing, both in Qt itself and in Qt-using projects.
QExplicitlySharedDataPointer (QESDP) is a cousin of QISDP with the important difference that you have to explicitly call detach() to detach from the underlying data. QSharedPointer is Qt's own "smart pointer" to shared data, similar to std::shared_ptr. I'm curious about the role/use for QESDP compared to QSharedPointer. The main differences I can see is * QESDP requires that the pointed-at object derive from QSharedData. * QSharedPointer provide no easy means to detach/make copies of the underlying object But regarding this second difference, wouldn't it be easy enough to just take the raw pointer to the underlying object with data(), and make a copy of that? In short, I fail to see a strong use case for QESDP compared to using a QSharedPointer. I'm probably missing something. Does anyone know of a code base that makes liberal use of QESDP, or could you share how you're making use of it? It's easy to find uses for the implicit variant (QISDP). In general I'm curious to hear advise about the do's and don'ts when it comes to QISDP, QESDP and QSharedPointer when designing the innermost parts (data model) of a Qt application. I've heard some warning words about using QISDP too library, because of the risks of "accidental detach". Thanks in advance, Elvis _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest