Coverage Report

Created: 2025-09-08 07:52

/usr/include/QtCore/qstack.h
Line
Count
Source
1
// Copyright (C) 2016 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 QSTACK_H
5
#define QSTACK_H
6
7
#include <QtCore/qlist.h>
8
9
QT_BEGIN_NAMESPACE
10
11
template<class T>
12
class QStack : public QList<T>
13
{
14
public:
15
    // compiler-generated special member functions are fine!
16
    void swap(QStack<T> &other) noexcept { QList<T>::swap(other); } // prevent QList<->QStack swaps
17
516k
    void push(const T &t) { QList<T>::append(t); }
18
    void push(T &&t) { QList<T>::append(std::move(t)); }
19
36.6k
    T pop() { return QList<T>::takeLast(); }
20
    T &top() { return QList<T>::last(); }
21
    const T &top() const { return QList<T>::last(); }
22
};
23
24
QT_END_NAMESPACE
25
26
#endif // QSTACK_H