diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2012-02-10 16:13:56 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-13 10:40:21 +0100 |
commit | f9872d12a6fb81aa0efa995720c7d733bbbdd71b (patch) | |
tree | b68bc7494fc86ddb1a45868f3220af439260d69c /src/corelib/tools/qarraydatapointer.h | |
parent | 113e9216844768152ebfe503e413db24fe53a1bf (diff) |
Add support for rvalue-references in QArrayDataPointer
I love how this magically makes SimpleVector move-aware :-)
Change-Id: I5cb75954d70cf256863c33e684ebc4551ac94f87
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/tools/qarraydatapointer.h')
-rw-r--r-- | src/corelib/tools/qarraydatapointer.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index 695a6f8b39..f5ad53aa54 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -86,6 +86,20 @@ public: return *this; } +#ifdef Q_COMPILER_RVALUE_REFS + QArrayDataPointer(QArrayDataPointer &&other) + : d(other.d) + { + other.d = Data::sharedNull(); + } + + QArrayDataPointer &operator=(QArrayDataPointer &&other) + { + this->swap(other); + return *this; + } +#endif + DataOps &operator*() const { Q_ASSERT(d); |