summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-04-19 19:12:21 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-09-03 10:57:10 (GMT)
commitda0e1a682362144b9f13b4c564f86e09efb681bb (patch)
tree8cbf68a93b055515b2a56d9e0667c530b27e39e2 /src/corelib/io
parent605aa0cf1889110620dc0d5d84066be8177fe9c2 (diff)
downloadQt-da0e1a682362144b9f13b4c564f86e09efb681bb.zip
Qt-da0e1a682362144b9f13b4c564f86e09efb681bb.tar.gz
Qt-da0e1a682362144b9f13b4c564f86e09efb681bb.tar.bz2
C++0x move operators
This makes assignement faster from temporaries, as the operator is fully inline, and doesn't do any atomic operations. Reviewed-by: joao
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdir.h4
-rw-r--r--src/corelib/io/qfileinfo.h4
-rw-r--r--src/corelib/io/qurl.h4
3 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index 28da271..0a56304 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -129,6 +129,10 @@ public:
QDir &operator=(const QDir &);
QDir &operator=(const QString &path);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QDir &operator=(QDir &&other)
+ { qSwap(d_ptr, other.d_ptr); return *this; }
+#endif
void setPath(const QString &path);
QString path() const;
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index 7e82aed..f0c6d60 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -67,6 +67,10 @@ public:
~QFileInfo();
QFileInfo &operator=(const QFileInfo &fileinfo);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QFileInfo&operator=(QFileInfo &&other)
+ { qSwap(d_ptr, other.d_ptr); return *this; }
+#endif
bool operator==(const QFileInfo &fileinfo); // 5.0 - remove me
bool operator==(const QFileInfo &fileinfo) const;
inline bool operator!=(const QFileInfo &fileinfo) { return !(operator==(fileinfo)); } // 5.0 - remove me
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 162aa7c..563be5f 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -94,6 +94,10 @@ public:
#ifndef QT_NO_URL_CAST_FROM_STRING
QUrl &operator =(const QString &url);
#endif
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QUrl &operator=(QUrl &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
~QUrl();
void setUrl(const QString &url);