title: Sorting list of shared pointers
body: <p>Given the class</p>
  
  <pre><code>class objects {
    public:
      bool compareArea (const objects&amp; obj) const { return this-&gt;area &lt; obj.area; }
    private:
      double area;
  };
  </code></pre>
  
  <p>I want to sort a </p>
  
  <pre><code>list&lt;shared_ptr&lt;objects&gt;&gt; myObjects;
  </code></pre>
  
  <p>I cannot use a lambda (since my toolchain's C++11 support is incomplete). Thus, I tried the following:</p>
  
  <pre><code>using namespace placeholders;
  myObjects.sort(bind(&amp;objects::compareArea,_1,_2));
  </code></pre>
  
  <p>This line is called from another file (not from a class member!). The problem is, that <code>compareArea</code> requires two <code>objects</code> as input. But I give two shared pointer to <code>objects</code> to it. Is there an easy way of how to include the dereferencing of the pointers <strong>into</strong> the <code>sort</code>-call? I want the <code>objects::compareArea(..)</code> function to stay as it is. I do <strong>not</strong> want this kind of solution</p>
  
  <pre><code>bool compareArea (const shared_ptr&lt;objects&gt;&amp; ptr1, const shared_ptr&lt;objects&gt;&amp; ptr2) {
    return ptr1-&gt;area &gt; ptr2-&gt;area;
  }
  
  // in same source-file:
  myObjects.sort(bind(compareArea,_1,_2));
  </code></pre>
  
  <p>where <code>compareArea</code> is no member-function of <code>objects</code>. Actually an operator overloading of <code>&lt;</code> would be my favourite solution.</p>