1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUEUE_H
5#define QQUEUE_H
6
7#include <QtCore/qlist.h>
8
9QT_BEGIN_NAMESPACE
10
11
12template <class T>
13class QQueue : public QList<T>
14{
15public:
16 // compiler-generated special member functions are fine!
17 inline void swap(QQueue<T> &other) noexcept { QList<T>::swap(other); } // prevent QList<->QQueue swaps
18 inline void enqueue(const T &t) { QList<T>::append(t); }
19 inline T dequeue() { return QList<T>::takeFirst(); }
20 inline T &head() { return QList<T>::first(); }
21 inline const T &head() const { return QList<T>::first(); }
22};
23
24QT_END_NAMESPACE
25
26#endif // QQUEUE_H
27

source code of qtbase/src/corelib/tools/qqueue.h