Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qstack.h
Go to the documentation of this file.
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
10
11template<class T>
12class QStack : public QList<T>
13{
14public:
15 // compiler-generated special member functions are fine!
16 void swap(QStack<T> &other) noexcept { QList<T>::swap(other); } // prevent QList<->QStack swaps
17 void push(const T &t) { QList<T>::append(t); }
18 T pop() { return QList<T>::takeLast(); }
19 T &top() { return QList<T>::last(); }
20 const T &top() const { return QList<T>::last(); }
21};
22
24
25#endif // QSTACK_H
Definition qlist.h:75
T & last()
Definition qlist.h:648
void swap(QList &other) noexcept
Definition qlist.h:337
value_type takeLast()
Definition qlist.h:567
void append(parameter_type t)
Definition qlist.h:458
\inmodule QtCore
Definition qstack.h:13
T & top()
Returns a reference to the stack's top item.
Definition qstack.h:19
T pop()
Removes the top item from the stack and returns it.
Definition qstack.h:18
const T & top() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstack.h:20
void swap(QStack< T > &other) noexcept
Definition qstack.h:16
void push(const T &t)
Adds element t to the top of the stack.
Definition qstack.h:17
Combined button and popup list for selecting options.
GLdouble GLdouble t
Definition qopenglext.h:243
QSharedPointer< T > other(t)
[5]