Note that TQValueStack does not store pointers to the members of the stack; it holds a copy of every member. That is why these kinds of classes are called "value based"; TQPtrStack, TQPtrList, TQDict, etc., are "pointer based".
A stack is a last in, first out (LIFO) structure. Items are added to the top of the stack with push() and retrieved from the top with pop(). The top() function provides access to the topmost item without removing it.
TQValueStack is a specialized TQValueList provided for convenience. All of TQValueList's functionality also applies to TQPtrStack, for example the facility to iterate over all elements using TQValueStack<T>::Iterator. See TQValueListIterator for further details.
Some classes cannot be used within a TQValueStack, for example everything derived from TQObject and thus all classes that implement widgets. Only values can be used in a TQValueStack. To qualify as a value, the class must provide
a default constructor, i.e. a constructor that does not take any arguments.
.PP
Note that C++ defaults to field-by-field assignment operators and copy constructors if no explicit version is supplied. In many cases this is sufficient.
Destroys the stack. References to the values in the stack and all iterators of this stack become invalidated. Because TQValueStack is highly tuned for performance, you won't see warnings if you use invalid iterators because it is impossible for an iterator to check whether or not it is valid.
Returns a reference to the top item of the stack or the item referenced by end() if no such item exists. Note that you must not change the value the end() iterator points to.