Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I would like to ask about data structures (stacks and queues) from both a competition programming perspective and a practical perspective.
I assume that stacks and queues are included in the standard library, but do you ever extend these classes yourself?

What I have tried:

Would like to hear from different people.
Not expanding at this time. Many people are of the opinion that
Updated 16-Feb-23 6:18am

Would like to hear from different people
Then this is not really the right forum for a discussion. Try posting on the C++ discussion board instead C / C++ / MFC Discussion Boards[^]
Share this answer
Stacks and Queues are specific structures that dont; really get "Extended" because they are generic already - they hold any type of data and provide the mechanisms to manipulate that data within the structure itself: push, pop, and peek for stacks, enqueue and dequeue for queues (along with the usual size related stuff). Extending that isn't normally necessary because what you would end up with isn;t a stack or queue! Certainly, I've never needed to extend a stack or queue, and I've been doing this stuff for over 40 years ... well before classes or generics even existed.

Instead, they get embedded into other classes which wrap them in a layer of data abstraction to hide the storage mechanism from "higher classes".
Share this answer
merano99 16-Feb-23 12:35pm    
nothing to add, 5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900