tests/geometry/test-eventqueue.cpp
author Dmitriy Morozov <morozov@cs.duke.edu>
Fri, 22 Feb 2008 18:29:43 -0500
branchar
changeset 66 6021ec481b1f
parent 55 7e71f5984931
child 200 73e8dce642be
permissions -rw-r--r--
Fixed Simulator not processing events correctly Event that is being processed needed to be removed from the queue while its own process() method ran.

#include <utilities/eventqueue.h>
#include <functional>
#include <iostream>

int main()
{
	typedef EventQueue<int, std::less<int> >			EQ;
	typedef EQ::iterator								iterator;
	 
	EQ queue;

	iterator i = queue.push(4);
	queue.push(2);
	queue.push(7);
	iterator j = queue.push(6);
	queue.push(5);

	*i = 8;
	queue.update(i);
	queue.remove(j);

	while (!queue.empty())
	{
		std::cout << *queue.top() << std::endl;
		queue.pop();
	}
}