![]() SourcePro C++ 12.5 |
SourcePro® C++ API Reference Guide |
Product Documentation: SourcePro C++ Documentation Home |
Maintains a stack of values. More...
#include <rw/tstack.h>
Public Member Functions | |
| RWTStack () | |
| RWTStack (const RWTStack &rhs) | |
| RWTStack (RWTStack &&rhs) | |
| void | clear () |
| size_t | entries () const |
| bool | isEmpty () const |
| RWTStack & | operator= (const RWTStack &rhs) |
| RWTStack & | operator= (RWTStack &&rhs) |
| T | pop () |
| void | push (const T &a) |
| void | push (T &&a) |
| More... | |
| void | swap (RWTStack< T, C > &rhs) |
| T | top () const |
Class RWTStack maintains a stack of values. Not only can the type of object inserted onto the stack be parameterized, but also the implementation of the stack.
Parameter T represents the type of object in the stack, either a class or built-in type. Class T must have:
T::T(const T&) or equivalent)T::operator=(const T&) or equivalent)C.Parameter C represents the class used for implementation. Useful choices are RWTValOrderedVector<T,A> or RWTValDlist<T,A>. Class RWTValSlist<T,A> can also be used, but note that singly-linked lists are less efficient at removing the last item of a list (function pop()), because of the necessity of searching the list for the next-to-the-last item.
None
Program output:
Copy constructor. Constructs self as a copy of rhs.
Move constructor. Takes ownership of the data owned by rhs.
|
inline |
Removes all items from the stack.
|
inline |
Returns the number of items currently on the stack.
|
inline |
Returns true if there are currently no items on the stack, otherwise false.
|
inline |
Assignment operator. Sets self to a copy of rhs.
Move assignment. Takes ownership of the data owned by rhs.
|
inline |
Pops (removes and returns) the item at the top of the stack.
| RWBoundsErr | Thrown if there are no items on the stack. |
|
inline |
Pushes the item a onto the top of the stack.
|
inline |
Pushes the item a onto the top of the stack.
Swaps the data owned by self with the data owned by rhs.
|
inline |
Returns (but does not remove) the item at the top of the stack.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.