Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.8.1
-
None
-
-
2
-
05b9a4b2d (dev), aff082764 (6.9), cad7935b6 (6.8), 287234704 (dev), cddddd753 (6.9)
-
Foundation Sprint 122, Foundation Sprint 123
Description
I know that std::as_const can be used; nevertheless, I would not expect QSpan<const T> to cause a Qt container to detach.
If this behavior is considered "normal," it should be mentioned and highlighted in the Qt documentation, as, IMHO, the current behavior does not align with the "Principle of Least Astonishment" for a Qt developer.
void foo(QSpan<const int>) { } void main() { QList<int> list{0, 1, 2}; QList<int> list2{list}; qDebug() << list2.isDetached(); // false foo(list2); qDebug() << list2.isDetached(); // true }