PopAndDestroy form the middle

Login to reply to this topic.
Tue, 2007-11-27 01:58
Joined: 2007-01-22
Forum posts: 30

if we push the following pointers to the stack as follows:

CleanupStack::PushL(obj1);
CleanupStack::PushL(obj2);
CleanupStack::PushL(obj3);

is it possible to pop as follows:

CleanupStack::Pop(obj2);

before I pop obj3?

rgds
nex


Tue, 2007-11-27 02:25
Joined: 2007-09-23
Forum posts: 132
Re: PopAndDestroy form the middle

No, it wouldn't be a stack if you could do that, it'd be a cleanupqueue or cleanuparray etc.

I've never come accross the need to do this, so are you sure you think you need to?

Tue, 2007-11-27 06:54
Joined: 2007-09-20
Forum posts: 95
Re: PopAndDestroy form the middle

No, it is not possible to do that way. The cleanupstack is a FILO. BTW why would you need to do that?


Chao,
Raghav

Tue, 2007-11-27 09:08
Joined: 2007-06-16
Forum posts: 29
Re: PopAndDestroy form the middle

then what would be the meaning of stack?


ready to face

Tue, 2007-11-27 09:47
Joined: 2007-01-22
Forum posts: 30
Re: PopAndDestroy form the middle

okey tank you all.

Tue, 2007-11-27 10:18
Joined: 2003-12-05
Forum posts: 587
Re: PopAndDestroy form the middle

You can, of course, pop out the topmost object(s), then popanddestroy the one you want, and pushl the other objects back again.

Tue, 2007-11-27 11:34
NewLC AdministratorSymbian AccreditedForum Nokia Champion
Joined: 2003-01-14
Forum posts: 1886
Re: PopAndDestroy form the middle

I've never come accross the need to do this, so are you sure you think you need to?

It happened to me once. In some quite shitty/badly structured code I must admit.

You can, of course, pop out the topmost object(s), then popanddestroy the one you want, and pushl the other objects back again.

And you probably don't have any other simple alternatives! This is at least why I did in my case.


Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant

  • Login to reply to this topic.