<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FBoost%2FHeap%2FIndirectCompare</id>
		<title>CPP/Boost/Heap/IndirectCompare - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FBoost%2FHeap%2FIndirectCompare"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/Boost/Heap/IndirectCompare&amp;action=history"/>
		<updated>2026-08-04T01:12:26Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=CPP/Boost/Heap/IndirectCompare&amp;diff=5183&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '&lt;syntaxhighlight lang=&quot;cpp&quot;&gt; #include &lt;boost/heap/binomial_heap.hpp&gt; #include &lt;boost/pending/indirect_cmp.hpp&gt; #include &lt;boost/array.hpp&gt; #include &lt;boost/graph/grid_graph.hpp&gt; #i…'</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/Boost/Heap/IndirectCompare&amp;diff=5183&amp;oldid=prev"/>
				<updated>2012-09-05T21:35:05Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;boost/heap/binomial_heap.hpp&amp;gt; #include &amp;lt;boost/pending/indirect_cmp.hpp&amp;gt; #include &amp;lt;boost/array.hpp&amp;gt; #include &amp;lt;boost/graph/grid_graph.hpp&amp;gt; #i…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/heap/binomial_heap.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/pending/indirect_cmp.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/array.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;boost/graph/grid_graph.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int, char*[])&lt;br /&gt;
{&lt;br /&gt;
  boost::array&amp;lt;std::size_t, 2&amp;gt; lengths = { { 2,2 } };&lt;br /&gt;
  typedef boost::grid_graph&amp;lt;2&amp;gt; GraphType;&lt;br /&gt;
  GraphType graph(lengths);&lt;br /&gt;
  typedef boost::graph_traits&amp;lt;GraphType&amp;gt;::vertex_descriptor Vertex;&lt;br /&gt;
  typedef boost::property_map&amp;lt;GraphType, boost::vertex_index_t&amp;gt;::const_type GridIndexMapType;&lt;br /&gt;
  GridIndexMapType gridIndexMap(get(boost::vertex_index, graph));&lt;br /&gt;
&lt;br /&gt;
  typedef boost::graph_traits&amp;lt;GraphType&amp;gt;::vertex_iterator VertexIteratorType;&lt;br /&gt;
  VertexIteratorType vertexIterator, vertexIteratorEnd;&lt;br /&gt;
&lt;br /&gt;
  typedef boost::vector_property_map&amp;lt;float, GridIndexMapType&amp;gt; PriorityMapType;&lt;br /&gt;
  PriorityMapType priorityMap(gridIndexMap);&lt;br /&gt;
&lt;br /&gt;
  typedef boost::indirect_cmp&amp;lt;PriorityMapType, std::less&amp;lt;float&amp;gt; &amp;gt; IndirectComparisonType;&lt;br /&gt;
  IndirectComparisonType indirectComparison(priorityMap);&lt;br /&gt;
&lt;br /&gt;
  typedef boost::heap::binomial_heap&amp;lt;Vertex, boost::heap::stable&amp;lt;false&amp;gt;, boost::heap::compare&amp;lt;IndirectComparisonType&amp;gt; &amp;gt; PriorityQueueType;&lt;br /&gt;
  PriorityQueueType pq(indirectComparison);&lt;br /&gt;
&lt;br /&gt;
  typedef typename PriorityQueueType::handle_type handle_t;&lt;br /&gt;
&lt;br /&gt;
  for( tie(vertexIterator, vertexIteratorEnd) = vertices(graph); vertexIterator != vertexIteratorEnd; ++vertexIterator)&lt;br /&gt;
  {&lt;br /&gt;
    put(priorityMap, *vertexIterator, rand() % 1000);&lt;br /&gt;
    pq.push(*vertexIterator);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  // Change all of the priorities in the map&lt;br /&gt;
  for( tie(vertexIterator, vertexIteratorEnd) = vertices(graph); vertexIterator != vertexIteratorEnd; ++vertexIterator)&lt;br /&gt;
  {&lt;br /&gt;
    put(priorityMap, *vertexIterator, rand() % 1000);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  // Resort the queue&lt;br /&gt;
  for( tie(vertexIterator, vertexIteratorEnd) = vertices(graph); vertexIterator != vertexIteratorEnd; ++vertexIterator)&lt;br /&gt;
  {&lt;br /&gt;
    //  pq.update(handle3, 5);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  // Output the final queue&lt;br /&gt;
  while(!pq.empty())&lt;br /&gt;
  {&lt;br /&gt;
    Vertex v = pq.top();&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; v[0] &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; v[1] &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
    pq.pop();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>