summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-11-14 13:46:12 +0100
committerLars Knoll <lars.knoll@qt.io>2019-12-16 17:38:26 +0100
commit287ace562ee5ddff22f7dbf4e49ae5f0520f2308 (patch)
treebcc7f8a5ca6f4f80356f04fa8b0e3ec2c255bba4 /src/corelib/tools
parent0915a08b335650793cc024da906d745dc804debe (diff)
Convert QString to use QArrayDataPointer
We're now using the same infrastructure for QVector, QString and QByteArray. This should also make it easier to remove the shared null in a follow-up change. Change-Id: I3aae9cf7912845cfca8e8150e9e82aa3673e3756 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qarraydatapointer.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index 1d13344991..7bba7241e9 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -191,6 +191,7 @@ public:
bool isMutable() const noexcept { return d->isMutable(); }
bool isStatic() const noexcept { return d->isStatic(); }
bool isShared() const noexcept { return d->isShared(); }
+ bool isSharedWith(const QArrayDataPointer &other) const noexcept { return d && d == other.d; }
bool needsDetach() const noexcept { return d->needsDetach(); }
size_t detachCapacity(size_t newSize) const noexcept { return d->detachCapacity(newSize); }
typename Data::ArrayOptions &flags() noexcept { return reinterpret_cast<typename Data::ArrayOptions &>(d->flags); }
@@ -204,6 +205,7 @@ public:
d = pair.first;
ptr = pair.second;
}
+ Data *d_ptr() { return d; }
private:
Q_REQUIRED_RESULT QPair<Data *, T *> clone(QArrayData::ArrayOptions options) const