I want to ask this question again, despite Why do Qt's container classes not allow movable, non-copyable element types? . I have read the following statement by QtCore maintainer Thiago (linked from the linked Stackoverflow question's answer):
Will not be implemented, ever. Copyability is a mandatory requirement due to implicit sharing.
I do not understand this statement: Copyability is a mandatory requirement for implicit sharing, I understand that part. But why is implicit sharing a requirement for a non-copyable QList<T>
?
QList
already has move-constructors and move-assignment-operators, so assuming that constructing a QList<T>
from another temporary QList<T>
will not apply implicit sharing, but move the underlying d-pointer, in what cases will implicit sharing arise when only copying/assigning temporary/rvalue QList
s around?