 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Gernot Frisch Guest
|
Posted: Thu Dec 30, 2004 7:29 am Post subject: queue where I can delete in the middle? |
|
|
Hi,
which container class can I use that has push/pop at front/back and
allows me to remove any object in the queue?
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
|
|
| Back to top |
|
 |
velthuijsen@hotmail.com Guest
|
Posted: Thu Dec 30, 2004 8:06 am Post subject: Re: queue where I can delete in the middle? |
|
|
deque and list.
Depending on which operation you are going to perform the most on the
container you have to chose between those two
If you expect a lot of insertions/deletions not on the ends a list is
more interesting.
If you expect only an occasional insert/delete not at the ends go for
the deque.
|
|
| Back to top |
|
 |
Mole Wang Guest
|
Posted: Thu Dec 30, 2004 10:52 am Post subject: Re: queue where I can delete in the middle? |
|
|
vector, list, deque...
I think any container can do.
"Gernot Frisch" <Me (AT) Privacy (DOT) net> wrote
| Quote: | Hi,
which container class can I use that has push/pop at front/back and
allows me to remove any object in the queue?
--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}
________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
|
|
|
| Back to top |
|
 |
Jonathan Mcdougall Guest
|
Posted: Thu Dec 30, 2004 5:15 pm Post subject: Re: queue where I can delete in the middle? |
|
|
Mole Wang wrote:
| Quote: | "Gernot Frisch" <Me (AT) Privacy (DOT) net> wrote
which container class can I use that has push/pop at front/back and
allows me to remove any object in the queue?
|
Don't top-post. Rearranged.
| Quote: | vector, list, deque...
I think any container can do.
|
No. Only sequential containers (vector, list,
deque and adapters stack, queue and priority
queue) can push and pop and some of them have
restrictions over front and back. For example,
vector has no push_front() function.
Only deque and list can push and pop at the end
and beginning while allowing "random" insert and
erase.
Jonathan
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|