Board index » cppbuilder » TStack

TStack


2004-06-14 09:33:20 PM
cppbuilder2
Hi
I saw some help comment in BCB help files about TStack
but I couldn't see any sample code to understand it as the best.
If possible please someone post a realy easy sample code to use these
Functions :
TStack::Pop()
TStack::Push()
TStack::Peek()
Thx
 
 

Re:TStack

You do me a big favor to teach them to me
Thanks and I approciate you and other ppl here , TeamB and Gambit :-)
 

Re:TStack

Quote
I saw some help comment in BCB help files about TStack
but I couldn't see any sample code to understand it as the best.
If possible please someone post a realy easy sample code to use these
Functions :
TStack::Pop()
TStack::Push()
TStack::Peek()
TStack is a relatively young VCL class. Its usage should be
straightforward. Just new a stack instance and add objects
to it.
#include <contnrs.hpp>
void test()
{
TStack stack = new TStack;
stack->Push(Form1);
stack->Push(Form2);
...
TForm *f = stack->Pop();
f->Show();
}
Note that TStack stores everything internally using a void *.
In this respect, it is much like TList. You can store ints and
pointers in TStack, but you can't store things that are not
4 bytes in size.
I recommend that you forget this class exists. Instead, use
std::vector or std::stack. They are more flexible and more
portable than TStack.
H^2
 

{smallsort}