Lecture overview -- Keyboard shortcut: 'u'  Previous page: Overview of containers -- Keyboard shortcut: 'p'  Next page: A map example -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Templates and The Standard Library - slide 25 : 39

A priority queue example

A priority queue is a heap

We show an example of a priority queue of points, which is built on top of double-ended queue

A priority queue relies on a comparison function - in our case the overloaded   <   operator in class Point

A priority queue adapts an underlying container, defaulted to vector - we try a deque instead.

point.h
Class point with an overloaded operator<.
point.cc
The implementation of class Point and in particular operator<.
pri-queue-1.cpp
Illustration of priority_queue<Point, deque<Point> >.