summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcommandlineparser.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-12-24 13:34:25 +0100
committerMarc Mutz <marc.mutz@qt.io>2025-01-13 01:43:30 +0100
commit287234704b57e171c786ba8df0b93c49edb903c5 (patch)
tree532c4299126ace89d33575f30f205a863e5c5c2d /src/corelib/tools/qcommandlineparser.cpp
parent793309693aac24e7f88fc225408d92def638996e (diff)
QSpan: don't detach Qt containers
When converting an implicitly-shared Qt container to QSpan, the QSpan ctor would call .data(), which detaches said Qt container (if it's not const). This is what must happen for mutable spans (QSpan<int>), but is not necessary for non-mutable spans (QSpan<const int>). Fix by copying the potential const from QSpan::element_type to the Range object in the resp. QSpan ctor. This makes a QSpan over a const element_type mark the range const before passing it to adl_data() (= member-data()). For a non-const element_type, nothing changes. [ChangeLog][QtCore][QSpan] No longer detaches implicitly-shared Qt containers converted to QSpan<const T, N>. Note that std::span<const T, N> will, however, detach such containers, so we recommend to use std::as_const() with implcitly-shared Qt containers, as always. Fixes: QTBUG-132133 Pick-to: 6.9 Change-Id: I9fdae20994d2c900bc5b45b44db3901d10f8838a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qcommandlineparser.cpp')
0 files changed, 0 insertions, 0 deletions