QXmlStreamStringRef: unbreak move special member functions
The QXmlStreamAttribute move operations expect QXmlStreamStringRef to have move special member functions, but in fact the non-trivial QXmlStreamStringRef dtor prevented them from being generated by the compiler. We can't remove the dtor, because it's exported :( So provide all the move special member functions by hand, and since their presence in turn prevents the copy special member functions from being generated, provide those too. Change-Id: I494aea24981cdb661abe33a96976a363cfe7ef1b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
2697d77141
commit
62f2a0fb0d
@ -53,7 +53,22 @@ public:
|
||||
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()){}
|
||||
inline ~QXmlStreamStringRef(){}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QXmlStreamStringRef(const QXmlStreamStringRef &other) // = default
|
||||
: m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {}
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QXmlStreamStringRef(QXmlStreamStringRef &&other) Q_DECL_NOTHROW // = default
|
||||
: m_string(std::move(other.m_string)), m_position(other.m_position), m_size(other.m_size) {}
|
||||
QXmlStreamStringRef &operator=(QXmlStreamStringRef &&other) Q_DECL_NOTHROW // = default
|
||||
{ swap(other); return *this; }
|
||||
#endif
|
||||
QXmlStreamStringRef &operator=(const QXmlStreamStringRef &other) // = default
|
||||
{ m_string = other.m_string; m_position = other.m_position; m_size = other.m_size; return *this; }
|
||||
inline ~QXmlStreamStringRef() {} // ### this prevents (or deprecates) all the move/copy special member functions,
|
||||
// ### that's why we need to provide them by hand above. We can't remove it in
|
||||
// ### Qt 5, since that would change the way its passed to functions. In Qt 6, remove all.
|
||||
#endif // Qt < 6.0
|
||||
|
||||
void swap(QXmlStreamStringRef &other) Q_DECL_NOTHROW
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user