How to retrieve a field array from an object array?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5174115/sorting-a-vector-of-objects-by-a-property-of-the-object">Sorting a vector of objects by a property of the object</a>  </p>
</blockquote>



<p>I have a structure like below:</p>

<pre><code>strcut Point
{
   int x;
   int y;
   int z;
};
</code></pre>

<p>I also have a generic sorting function for integers:</p>

<pre><code>void sort(vector&lt;int&gt;);              
</code></pre>

<p>In my program, I need to sort an array of points std::vector frequently using different fields (i.e. x, y, or z). What can I do to convert an array of Points into an an array of integers efficiently?</p>
