title: Keeping vector of iterators of the data
body: <p>I have a function :</p>
  
  <pre><code>void get_good_items(const std::vector&lt;T&gt;&amp; data,std::vector&lt;XXX&gt;&amp; good_items);
  </code></pre>
  
  <p>This function should check all data and find items that satisfies a condition and return <strong>where they are</strong> in good_items.</p>
  
  <p>what is best instead of <code>std::vector&lt;XXX&gt;</code>?</p>
  
  <ol>
  <li><code>std::vector&lt;size_t&gt;</code> that contains all good indices.</li>
  <li><code>std::vector&lt;T*&gt;</code> that contain a pointers to the items.</li>
  <li><code>std::vector&lt;std::vector&lt;T&gt;::iterator&gt;</code> that contains iterators to the items.</li>
  <li>other ??</li>
  </ol>
  
  <p><strong>EDIT:</strong></p>
  
  <p>What will I do with the <code>good_items</code>?
  Many things... one of them is to delete them from the vector and save them in other place. maybe something else later</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>One of the most important for me is how will accessing the items in <code>data</code> will be fast depending on the struct of <code>good_items</code>?</p>
  
  <p><strong>EDIT 3:</strong></p>
  
  <p>I have just relized that my thought was wrong. Is not better to keep raw pointers(or smart) as items of the vector so I can keep the real values of the vector (which are pointers) and I do not afraid of heavy copy because they are just pointers?</p>