SourcePro® 2022.1 |
SourcePro® API Reference Guide |
Maintains a stack of values. More...
#include <rw/tstack.h>
Public Member Functions | |
RWTStack () | |
RWTStack (const C &rhs) | |
RWTStack (const RWTStack &rhs) | |
RWTStack (C &&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) |
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. The class C
must provide the following interface (or equivalent):
void C::append(const T&)
void C::clear()
size_t C::entries() const
T C::last()
bool C::isEmpty() const
T C::removeLast()
C::C()
)C::C(const C&)
)C& C::operator=(const C&)
)These methods must behave in a manner that is consistent with that of RWTValDlist for this class to function as intended.
Useful choices for C
are RWTValDlist or RWTValOrderedVector. Singly- linked list classes, such as RWTValSlist, can also be used, but tend to be less efficient at removing the last item.
Constructs a stack from the container rhs.
Copy constructor. Constructs self as a copy of rhs.
Move constructor. Takes ownership of the data owned by rhs.
Move constructor. Takes ownership of the data owned by rhs.
|
inline |
Calls C::clear()
on the underlying container.
|
inline |
Returns the result of calling C::entries()
on the underlying container.
|
inline |
Returns the result of calling C::isEmpty()
on the underlying container.
|
inline |
Assignment operator. Sets self to a copy of rhs.
Move assignment. Takes ownership of the data owned by rhs.
|
inline |
Returns the result of calling C::removeLast()
on the underlying container.
|
inline |
Calls C::append(a)
on the underlying container.
|
inline |
Calls C::append(a)
on the underlying container.
Swaps the data owned by self with the data owned by rhs.
|
inline |
Returns the result of calling C::last()
on the underlying container.
Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |