Sorting a vector of objects in C++
<p>say I have a class "Information" and it stores the Name and Age of people in a vector.</p>

<p>so...</p>

<pre><code>class Information {

private:
int age;
string name;

//etc, etc...
};
</code></pre>

<p>How would I sort the vector in either ascending/descending order with respect to age?</p>

<p>I believe you use something like this.</p>

<pre><code>sort(listOfPeople.begin(), listOfPeople.end(), greater&lt;Information&gt;());
</code></pre>

<p>listOfPeople would be the vector.</p>

<p>Any help would be greatly appreciated.</p>
