title: Implementing endless map in memory
body: <p>I will have to implement an endless 3D raster map in program memory. The map may or may NOT start at [0;0;0]. The map has Y coordinate limited by 255, others may be infinite. (yes, now, you may have guessed it is a Minecraft map)<br>
  I need to create some class which will have simple <code>McMap::getBlock(int x, short y, int z)</code> and <code>McMap::setBlock(int x, short y, int z)</code> method. Means I need to be able to both read and write the data. I also want to be able to <strong>delete blocks</strong> and so <strong>free the memory</strong>.<br>
  What should  user for this purpose? I think the best solution would be some table with such structure:</p>
  
  <pre><code>int x|short y|int z|int block id|other values...
  -----+-------+-----+------------+---------------
     55|     21|  666|           1|
  </code></pre>
  
  <p>But how do I implement this with C++, without using real MySql (that would be real overkill)? Also, I don't want to <strong>keep</strong> the map when the program exits, so I want the data to be <strong>inside</strong> the programs memory.<br>
  Once more, consider that the map <strong>is infinite</strong> and so the coordinates may be <strong>whatever</strong>. Also do not forget that a <strong>very distant</strong> points may be mapped.<br>
  Also, a very important thing to note: I need to have an <strong>effective way</strong> to get block by X, Y and Z coordinates - I <strong>don't</strong> want to walk through all block to find one of them.<br>
  I have already included <a href="/questions/tagged/boost" class="post-tag" title="show questions tagged 'boost'" rel="tag">boost</a> library.</p>