summaryrefslogtreecommitdiffstats
path: root/src/corelib/xml
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-19 12:39:13 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-11-29 11:51:15 +0000
commit9291e2e667989c2321da86076dc6b625bb8a71b2 (patch)
tree91438f1366357d6704b636a588b3299b0f9bcde0 /src/corelib/xml
parentf7ab19955ffde7b0cf9e1dcb66223c515f775926 (diff)
QXmlStreamStringRef: overload ctor from QString with an rvalue version
The only tricky part here is to take the size of the moved-to member, not the moved-from parameter QString object. To avoid accidents, give the lvalue version the same structure. Change-Id: Ic68bb896f1d817c21d913feab43522235c51029b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/xml')
-rw-r--r--src/corelib/xml/qxmlstream.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h
index 34f26cb953..5b5a2e552e 100644
--- a/src/corelib/xml/qxmlstream.h
+++ b/src/corelib/xml/qxmlstream.h
@@ -52,7 +52,10 @@ public:
inline QXmlStreamStringRef():m_position(0), m_size(0){}
inline QXmlStreamStringRef(const QStringRef &aString)
:m_string(aString.string()?*aString.string():QString()), m_position(aString.position()), m_size(aString.size()){}
- inline QXmlStreamStringRef(const QString &aString):m_string(aString), m_position(0), m_size(aString.size()){}
+ QXmlStreamStringRef(const QString &aString) : m_string(aString), m_position(0), m_size(m_string.size()) {}
+#ifdef Q_COMPILER_RVALUE_REFS
+ QXmlStreamStringRef(QString &&aString) Q_DECL_NOTHROW : m_string(std::move(aString)), m_position(0), m_size(m_string.size()) {}
+#endif
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QXmlStreamStringRef(const QXmlStreamStringRef &other) // = default