queue where I can delete in the middle?

G

Gernot Frisch

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
 
V

velthuijsen

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.
 
J

Jonathan Mcdougall

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top