title: Blocking queue with order guarantee
body: <p>I have 8 threads that process an image in strips. The strips are ordered in raster order. When each thread is finished with a strip, the thread adds its strip id number to a blocking queue. I want the queue to only allow a pop when the number is in sequence from 0 to N.  So, regardless of the order in which the threads add their IDs, the queue output will be 0,1,2,3,.....N.
  Is there an existing construct in the STL that has this functionality ?</p>
  <p>I suppose a simple implementation would be a vanilla queue with a counter starting at 0. When 0 gets added, it pops and moves the counter to 1, and keeps popping until it doesn't find a match. But this sounds inefficient.</p>
  <p>Edit: if I wrap an STL priority queue to make it blocking, this could work.</p>