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>
This commit is contained in:
parent
f7ab19955f
commit
9291e2e667
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user