SourcePro C++ 13.0 |
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 C &rhs) | |
RWTStack (const RWTStack &rhs) | |
RWTStack (C &&rhs) | |
RWTStack (RWTStack &&rhs) | |
More... | |
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. 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<T,A> for this class to function as intended.
Useful choices for C
are RWTValDlist<T,A> or RWTValOrderedVector<T,A>. Singly- linked list classes, such as RWTValSlist<T,A>, can also be used, but tend to be less efficient at removing the last item.
None
Program output:
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 © 2014 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.