// Copyright (C) 2016 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 QSTACK_H #define QSTACK_H #include QT_BEGIN_NAMESPACE template class QStack : public QList { public: // compiler-generated special member functions are fine! void swap(QStack &other) noexcept { QList::swap(other); } // prevent QList<->QStack swaps void push(const T &t) { QList::append(t); } T pop() { return QList::takeLast(); } T &top() { return QList::last(); } const T &top() const { return QList::last(); } }; QT_END_NAMESPACE #endif // QSTACK_H