Search⌘ K
AI Features

A ToDo List Using Multimap

Explore how to build a prioritized ToDo list using the C++ STL multimap container. Learn to use reverse iterators to traverse and print tasks in descending priority order, overcoming the limitations of other containers like priority_queue. This lesson enables you to handle ordered collections efficiently and operate on them with STL iterators.

We'll cover the following...

An ordered task list (or a ToDo list) is a common computing application. Formally stated, it's a list of tasks associated with a priority, sorted in reverse numerical order.

We may be tempted to use a priority_queue for this, because as the name implies, it's already sorted in priority (reverse numerical) order. The disadvantage of a priority_ queue is that it has no iterators, so it's difficult to operate on it without pushing and popping items to and from the queue. ...