title: Is there a BOOST pool fixed-sized allocator?
body: <p>I want to create <code>unordered_map</code>(Because I specifically want a hash map). I want to allocate its max size (according to my constraints) in the beginning.<br>
  So, if I want to allocated 256 entries, and the size of each entry is 1B (just an example. Let's say 1Byte includes the Key and the Value). Then the total size of my <code>unordered_map</code> keys + entries is 256B. I want to pre-allocate 256B in the allocator.<br>
  Then, when the <code>unordered_map</code> will call <code>allocate()</code>/<code>deallocate()</code>, the <code>allocator</code> will give it 1B from the already-allocated memory.  </p>
  
  <p><code>typedef boost::unordered::unordered_map&lt;int, MyClass, boost::hash&lt;int&gt;, std::equal_to&lt;MyClass&gt;, ??? &gt; &gt; myMap</code></p>
  
  <p>Does it exists in BOOST? or somewhere else?</p>
  
  <p>---- edit ----</p>
  
  <p>As I see it (Thanks to the answers here) - there are two solutions for my problem:</p>
  
  <ol>
  <li><p>Implement an <code>allocator</code>, which holds a <code>boost::pool&lt;&gt;</code>. This <code>pool</code> is built in the <code>allocator</code> constructor. When <code>allocate()</code> is being called from <code>unordered_map</code>, it actually calls <code>pool.malloc()</code>, and when <code>deallocate()</code> is called from <code>unordered_map</code>, it actually calls <code>pool.free()</code>.</p></li>
  <li><p>Use an already implemented <code>allocator</code>, such as <code>pool_allocator</code> like this:  </p></li>
  </ol>
  
  <p><code>typedef pool_allocator&lt;std::pair&lt;MyKey, MyClass&gt;, boost::default_user_allocator_new_delete, boost::mutex, 1024 &gt;) MyAllocator;</code><br>
  <code>typedef unordered_map&lt;MyKey, MyClass, hash, eq, MyAllocator&gt; MyUnorderedMap;</code></p>
  
  <p>The seconds option is still unclear to me, because:<br>
  a. Can I declare only one MyUnorderedMap?<br>
  b. How can I declare a new MyUnorderedMap with different <code>next_block</code> size than <code>1024</code> in run time?</p>