On Thu, Sep 8, 2016 at 11:21 PM, Elvis Stansvik <elvst...@gmail.com> wrote:
> (I think you forgot to include the list in your reply) Yes, I'm sorry about that. > I know that it's mentioned in the docs what you bring up (and that > Thiago also brought up), that a QSP manages a *pointer*, while QESDP > manages *data*. But I still can't say that I'm 100% sure why I can't > do with QSP what I can do with QESDP... > You can, and if you find it easier you probably should. From what I've seen QESDP is used rather rarely. > In this use case, I can't quite see why I couldn't use a QSP instead > Again, you can. > So is the difference really just the slightly different API and > slightly different way of doing a deep copy? (I consider the > external/internal refcount mostly a technical difference). > I admit you got me curious, so I looked up the source. It seems QESDP is a bit more efficient (no external structure and custom (de)allocator) because of the internal reference counting. It does, however, detach exactly as you'd do manually[1]. I'd expect it'd perform marginally better for small objects compared to QSP, whereas for big fat data structures I'd expect no gain whatsoever. In any case as always I think one's best bet is using what *feels* most natural to the case on hand, however esoteric this might sound. :) Kind regards, Konstantin. [1]: http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/tools/qshareddata.h#n229
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest