title: Remove duplicates from a list<int>
body: <p>Using STL algorithms (as much as possible) such as <code>remove_if()</code> and <code>list::erase</code>, is there a nice way to remove duplicates from a list defined as following:</p>
  
  <p><code>list&lt;int&gt; l;</code></p>
  
  <p>Please note that <code>list::unique()</code> only works if duplication occurs in consecutive elements. In my case, all duplicates have to be eliminated regardless of their position in the list. Moreover, removing duplicates mean preserving only one copy of each element in the final result.</p>
  
  <p>EDIT: The option to <code>l.sort()</code> followed by <code>l.unique()</code> cannot be availed as that will destroy the order of the list.</p>