QTextFrame::iterator: restore nothrow move special members

The user-defined copy assignment and copy constructors
inhibit the move special member functions.

We cannot do something about it in Qt 5, because the
class is exported (which it shouldn't be), and because
making it trivially-copyable might change how it is
passed to functions by value, so we need to supply all
the missing member functions manually.

Change-Id: Ic710b449f6abd386449fa6df71e8bc9bd0f98d2b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
Marc Mutz 2016-02-10 15:43:15 +01:00
parent 6ffb0bdf60
commit 7f48655fb8
2 changed files with 9 additions and 5 deletions

View File

@ -675,7 +675,7 @@ QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end)
/*!
Copy constructor. Constructs a copy of the \a other iterator.
*/
QTextFrame::iterator::iterator(const iterator &other)
QTextFrame::iterator::iterator(const iterator &other) Q_DECL_NOTHROW
{
f = other.f;
b = other.b;
@ -688,7 +688,7 @@ QTextFrame::iterator::iterator(const iterator &other)
Assigns \a other to this iterator and returns a reference to
this iterator.
*/
QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other)
QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) Q_DECL_NOTHROW
{
f = other.f;
b = other.b;

View File

@ -148,10 +148,14 @@ public:
friend class QTextDocumentLayoutPrivate;
iterator(QTextFrame *frame, int block, int begin, int end);
public:
iterator();
iterator(); // ### Qt 6: inline
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
iterator(const iterator &o);
iterator &operator=(const iterator &o);
iterator(const iterator &o) Q_DECL_NOTHROW; // = default
iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default
iterator(iterator &&other) Q_DECL_NOTHROW // = default
{ memcpy(this, &other, sizeof(iterator)); }
iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default
{ memcpy(this, &other, sizeof(iterator)); return *this; }
#endif
QTextFrame *parentFrame() const { return f; }