Module 4 · array and deque: Fixed Size, and Growing at Both Ends
When to Use array, deque or vector, and When Not To
Free with an accountReading
Maria's print shop keeps its queue of jobs in a vector. Each finished job leaves with erase(jobs.begin()), and every job behind it shifts one place. Kenji "fixes" it by turning every container in the shop into a deque, including the million readings his report adds up by index. Amara asks them both one question: what did you need? This lesson is her answer.
Checking what this lesson needs for you…
What is inside When to Use array, deque or vector, and When Not To
- Five questions about your data
- The comparison chart
- The decision flowchart
- Kenji's loop: indexing a deque, measured
- Maria's queue: the front, measured
- When std::array is the wrong pick
- std::queue is a deque underneath
- A preview: the sliding window