A ToDo List Using Multimap
Learn to make a to-do list using Multimap.
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.
For this recipe, we'll use a multimap
for the ordered list. The multimap
associative container keeps items in order, and it can be accessed using
How to do it
This is a short and simple recipe that initializes a multimap
and prints it in reverse order.
We start with a type alias for our
multimap
:
Get hands-on with 1400+ tech skills courses.