Re: Newbie Question: implementing a stack

2008-12-20 Thread Michael Ash
On Sat, Dec 20, 2008 at 6:52 PM, Steve Wetzel wrote: > I do see your point Graham but what I am trying to understand is how to work > with the stack if I don't copy the object to put on it. If I simply push > the pointer on the stack, it seems that I have to make a lot of objects in > the code th

Re: Newbie Question: implementing a stack

2008-12-20 Thread Graham Cox
On 21 Dec 2008, at 10:52 am, Steve Wetzel wrote: I guess can simply assign the pointer, but if I do, it seems to me I will need an NSMutableArray to hold myObj1... myObj10 (or more). If I do that, what benefit is the stack? I don't really follow your argument. Presumably you decided you

Re: Newbie Question: implementing a stack

2008-12-20 Thread Steve Wetzel
On Dec 20, 2008, at Dec 20:12:08 AM, Graham Cox wrote: On 20 Dec 2008, at 4:52 pm, Graham Cox wrote: On 20 Dec 2008, at 3:15 pm, Steve Wetzel wrote: Regarding memory management - does it make more sense to copy the object to be pushed from within the Stack object rather then copying it

Re: Newbie Question: implementing a stack

2008-12-20 Thread Dave DeLong
Sorry to jump in to this a little late, but a guy in our CocoaHeads group wrote a framework as part of his Master's thesis work. It's a datastructure framework and contains a bunch of datastructures not available (publicly) in Cocoa, such as stacks, queues, dequeues, avl/ rb/aa-trees, treap

Re: Newbie Question: implementing a stack

2008-12-19 Thread Graham Cox
On 20 Dec 2008, at 4:52 pm, Graham Cox wrote: On 20 Dec 2008, at 3:15 pm, Steve Wetzel wrote: Regarding memory management - does it make more sense to copy the object to be pushed from within the Stack object rather then copying it externally before the push call? I am thinking that it

Re: Newbie Question: implementing a stack

2008-12-19 Thread Graham Cox
On 20 Dec 2008, at 3:15 pm, Steve Wetzel wrote: Regarding memory management - does it make more sense to copy the object to be pushed from within the Stack object rather then copying it externally before the push call? I am thinking that it does because then that object is encapsulated wh

Re: Newbie Question: implementing a stack

2008-12-19 Thread Steve Wetzel
On Dec 19, 2008, at Dec 19:6:31 PM, Ricky Sharp wrote: On Dec 19, 2008, at 1:22 PM, Steve Wetzel wrote: I am new to this list and new to mac programming as well. I am working on implementing a stack as a category of NSMutableArray. I want this stack to be able to store objects. This is

Re: Newbie Question: implementing a stack

2008-12-19 Thread Ricky Sharp
On Dec 19, 2008, at 1:22 PM, Steve Wetzel wrote: I am new to this list and new to mac programming as well. I am working on implementing a stack as a category of NSMutableArray. I want this stack to be able to store objects. This is what I have so far: // // Stack.h // Stack implemen