title: QList, QVector or std::vector multi-threaded usage
body: <p>I would like two threads work like this:</p>
  
  <ol>
  <li>First thread will append values to vector</li>
  <li>Second thread will have read-only access to elements by index</li>
  </ol>
  
  <p>I can make mutex and make deep copy before second thread start reading.... But this way is really slow... How is it possible to make this without mutex? Here: <a href="https://stackoverflow.com/questions/4346742/stl-vector-and-thread-safety">STL vector and thread-safety</a>
  I read that it is possible to use std::deque, but it fails like std::vector ...</p>
  
  <p>Where I can find append-only container, which don't realloc data?</p>
  
  <hr>
  
  <p>I have solved my problem by creating own container GrowVector with operations: adding elements to back, getting size, accessing element by index. It works for 2Billion elements for default, but it can be changed by constructor parameter.</p>
  
  <pre><code>#include &lt;vector&gt;
  
  template&lt;typename T&gt;
  class GrowVector
  {
      std::vector&lt;std::vector&lt;T&gt; &gt; m_data;
      size_t m_size;
  
  public:
      GrowVector(int chunks = 32768)
          : m_data()
          , m_size(0)
      {
          m_data.reserve(chunks);
          m_data.push_back(std::vector&lt;T&gt;());
          m_data.back().reserve(1 &lt;&lt; 16);
      }
  
      void add(const T &amp; value)
      {
          if (m_data.back().size() == m_data.back().capacity())
          {
              m_data.push_back(std::vector&lt;T&gt;());
              m_data.back().reserve(1 &lt;&lt; 16);
          }
  
          m_data.back().push_back(value);
          m_size++;
      }
  
      size_t size() const
      {
          return m_size;
      }
  
      T &amp; operator [] (int i)
      {
          return m_data[i &gt;&gt; 16][i &amp; 0xffff]; 
      }
  
      const T &amp; operator [] (int i) const
      {
          return m_data[i &gt;&gt; 16][i &amp; 0xffff];    
      }
  };
  </code></pre>
  
  <p>Is my solution safe?</p>