title: removing duplicates from a c++ list
body: <p>I have been looking for an effective solution to remove duplicates from a C++ list.</p>
  
  <p>The list consists of pointers to a class object which has an attribute ID. I want to remove duplicates based on that ID.</p>
  
  <p>for my purpose, the unique method of the STL list will work in which we can pass a BinaryPredicate. i.e.</p>
  
  <p>void unique( BinPred pr );</p>
  
  <p>I searched on the internet about how to use this method, n got an example in which we can declare a function returning boolean and use the "name" of that function as Binary Predicate.</p>
  
  <p>But it's not working.</p>
  
  <p>What actually is this binary predicate and how do i use it ? ... 
  Any help will be appreciated.
  Here is the code snippet:</p>
  
  <pre><code>class SP_MDI_View {
  ..
  ..
  bool removeDupli(SP_DS_Node*, SP_DS_Node*);
  bool DoReductionGSPN(SP_DS_Node*, SP_ListNode*, SP_DS_Node*);
  ..
  ..
  }
  SP_MDI_View::DoReduction( ... ) {
   SP_ListNode setZ; // typedef list&lt;SP_DS_Node*&gt; SP_ListNode, where SP_DS_Node is some other class
   setZ.clear();
   setZ.merge(tempsubset);
   setZ.merge(setX);
   setZ.push_back(*cs_iter);
   setZ.unique(removeDupli); //Error here
  }
  bool SP_MDI_View::removeDupli(SP_DS_Node* first, SP_DS_Node* second) {
  return ( (first-&gt;GetId())==(second-&gt;GetId()) );
  }
  </code></pre>