[SOLVED] Q_MOVABLE_TYPE and QSharedDataPointer



  • Can a class containing a QSharedDataPointer be safely declared moveable, provided the object pointed to does not have a back pointer?

    That is, is there a guarantee that the QSharedDataPointer / QSharedData pair does not hide a back pointer somewhere in its implementation?



  • Since no-one could answer this rather basic and sometimes crucial question, I forwarded it to Qt support.

    I'll post their answer here, as soon as I get it.



  • Answer from support:

    bq. Provided that your type is movable then yes it is safe to declare a class as a movable type. The QSharedDataPointer<T> is already movable so you can indicate that the class itself is too. I think it is safe to assume that this behavior will be working in future versions, behavior changes can happen but something on this level would most likely only change between major releases.



  • Thanks for sharing!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.