title: (preferably boost) lock-free array/vector/map/etc?
body: <p>Considering my lack of c++ knowledge, please try to read my intent and not my poor technical question.</p>
  
  <p>This is the backbone of my program <a href="https://github.com/zaphoyd/websocketpp/blob/experimental/examples/broadcast_server/broadcast_server.cpp" rel="nofollow">https://github.com/zaphoyd/websocketpp/blob/experimental/examples/broadcast_server/broadcast_server.cpp</a></p>
  
  <p>I'm building a websocket server with websocket++ (and oh is websocket++ sweet.  I highly recommend), and I can easily manipulate per user data thread-safely because it really doesn't need to be manipulated by different threads; however, I do want to be able to write to an array (I'm going to use the catch-all term "array" from weaker languages like vb, php, js) in one function thread (with multiple iterations that could be running simultanously) and also read in 1 or more threads.</p>
  
  <p>Take stack as an example: if I wanted to have all of the <code>id</code>s (<code>PRIMARY</code> column of all articles) sorted in a particular way, in this case by net votes, and held in memory, I'm thinking I would have a function that's called in its' own <code>boost::thread</code>, fired whenever a vote on the site comes in to reorder the array.</p>
  
  <p>How can I do this without locking &amp; blocking?  I'm 100% fine with users reading from an old array while another is being built, but I absolutely do not want their reads or the thread writes to ever fail/be blocked.</p>
  
  <p>Does a lock-free array exist?  If not, is there some way to build the new array in a temporary array and then write it to the actual array when the building is finished without locking &amp; blocking?</p>