Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

queue where I can delete in the middle?

0 views
Skip to first unread message

Gernot Frisch

unread,
Dec 30, 2004, 2:29:17 AM12/30/04
to
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


velth...@hotmail.com

unread,
Dec 30, 2004, 3:06:55 AM12/30/04
to
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.

Mole Wang

unread,
Dec 30, 2004, 5:52:21 AM12/30/04
to
vector, list, deque...
I think any container can do.
"Gernot Frisch" <M...@Privacy.net> wrote in message news:33housF...@individual.net...

Jonathan Mcdougall

unread,
Dec 30, 2004, 12:15:01 PM12/30/04
to
Mole Wang wrote:
> "Gernot Frisch" <M...@Privacy.net> wrote in message news:33housF...@individual.net...
>
>>
>>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.

> 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

0 new messages