diff --git a/src/corelib/tools/qqueue.cpp b/src/corelib/tools/qqueue.cpp index 74ab49b3bf9..a0ebf7e32ff 100644 --- a/src/corelib/tools/qqueue.cpp +++ b/src/corelib/tools/qqueue.cpp @@ -48,6 +48,7 @@ /*! \fn template void QQueue::enqueue(const T& t) + \fn template void QQueue::enqueue(T&& t) Adds value \a t to the tail of the queue. diff --git a/src/corelib/tools/qqueue.h b/src/corelib/tools/qqueue.h index 4863499f2a8..b41be9555ef 100644 --- a/src/corelib/tools/qqueue.h +++ b/src/corelib/tools/qqueue.h @@ -16,6 +16,7 @@ public: // compiler-generated special member functions are fine! inline void swap(QQueue &other) noexcept { QList::swap(other); } // prevent QList<->QQueue swaps inline void enqueue(const T &t) { QList::append(t); } + inline void enqueue(T &&t) { QList::append(std::move(t)); } inline T dequeue() { return QList::takeFirst(); } inline T &head() { return QList::first(); } inline const T &head() const { return QList::first(); }