title: Sorting vector of pointers
body: <p>I'm having a little trouble trying to sort a vector of pointers.</p>
  
  <p>This is what I have done so far:</p>
  
  <pre><code>class Node
  {
      private:
      vector &lt;Node*&gt; _children;
      string _data;
      ...
      public:
      void Node::add_child(Node* child)
      {
          ...
          sort(_children.begin(), _children.end());
      }
  
      bool Node::operator&lt;(const Node&amp; node)
      {
          return (this-&gt;_data.compare(node._data) == -1);
      }
  };
  </code></pre>
  
  <p>My less-than operator works, if I write like this:</p>
  
  <pre><code>Node* root = new Node("abc");
  Node* n = new Node("def");
  cout &lt;&lt; (*root&lt;*n) &lt;&lt; endl;
  </code></pre>
  
  <p>Why does sort never call the operator?? Any help would be appreciated!
  Thanks.</p>
  
  <p>madshov</p>