title: Printing a Priority Queue
body: <p>I am attempting to print a STL priority_queue in C++, but I am having issues printing all elements of the queue.</p>
  
  <pre><code>priority_queue&lt;Job, vector&lt;Job&gt;, greater&lt;Job&gt;&gt; q = pq;
  for(int i = 0; i &lt;= q.size(); i++) {
      cout &lt;&lt; q.top() &lt;&lt; "\n";
      q.pop();
  }
  </code></pre>
  
  <p>However, using this code when there is one or two elements in the list it is fine, but as soon as I enter three or more elements it cuts off the last item to be printed. I'm not really sure why this is happening but it's been confusing me for a little while.</p>