#35869 - 2003-01-30 04:34 PM
Re: stack-like (push/pop) functions for arrays?
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Your welcome.
I don't have a "delete" UDF to hand (and I'm just off home), but I'm sure one will be along in a moment...
A couple of warnings if you are going to use these UDFs:
- To keep it simple and fast, the pop/push is using the "high" end of the array as the top of the stack, not array subscript 0. Use Ubound() if you want to "peek" at the top of the stack.
- To identify an empty stack the array is destroyed when the last element is popped. Be careful about referencing the stack especially in an array context - if you use an array reference on a depleted stack you will likely get a runtime error. This is the reason for the VarType() checks in the UDFs.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 302 anonymous users online.
|
|
|