Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWTStack<T,C>

Module:  Essential Tools Module   Group:  Traditional Collection Classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/tstack.h>
RWTStack<T, C> stack;

Description

This class 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. The class T must have:

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.

Persistence

None

Example

In this example a stack of ints, implemented as an ordered vector, is exercised.

Program output:

Public Member Functions

void
clear();
size_t
entries() const; 
bool
isEmpty() const; 
void
push(T a); 
T
pop();
T
top() const; 


Previous fileTop of DocumentContentsIndex pageNext file

© 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.
Contact Rogue Wave about documentation or support issues.