// Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QQUEUE_H #define QQUEUE_H #include QT_BEGIN_NAMESPACE template class QQueue : public QList { 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 T dequeue() { return QList::takeFirst(); } inline T &head() { return QList::first(); } inline const T &head() const { return QList::first(); } }; QT_END_NAMESPACE #endif // QQUEUE_H