title: c++ data structure that automatically sort objects by the value of a member
body: <p>In STL, list is a data structure that automatically sort the numbers by their values. If the elements are not numbers but instances of a class, and I want the container to automatically sort the elements by the value of a member of the class, what kind of container should I use? e.g. </p>
  
  <pre><code>class Rect{
      double height;
      double width;
      double area;
  };
  </code></pre>
  
  <p>I want the container to automatically sort by <code>area</code> of the rectangle. </p>