I am writing a program in C++ in which I will have to have a container with the following characteristics:
- It is basically FIFO
- I will put elements at the end
- I will take elements from the top
- I will take elements after a search
If only the three conditions would be needed, then I think a queue will be ideal.
However, sometimes I will have to take out elements depending on their values. For example, say I have the elements {1,2,3,4} , I can do take(2) and the resulting container will have to be {1,3,4}
On other occasions the take will happen only on the top.
What would be the best or recommended way to implement this, taking into account issues like performance?