title: c++ get unique values in set and map containers
body: <p>How can I get unique values in container?
  I see there is <code>unique()</code> for vector and list, but I can't find anything similar for set and map.</p>
  
  <p>UPD: I use this to generate values in container.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;list&gt;
  #include &lt;set&gt;
  #include &lt;map&gt;
  
  
  using namespace std;
  template &lt;class T&gt;
  void rvec(T&amp; t, int l) {
      for (int i = 0; i &lt; l; i++)t.push_back(rand() % 10);
  }
  template &lt;class T&gt;
  void rlist(T &amp;t, int l){
    for(int i=0;i&lt;l;i++)t.push_back(rand()%10);
  }
  template &lt;class T&gt;
  void rmset(T &amp;t, int l){
    for(int i=0;i&lt;l;i++)t.insert(rand()%10);
  }
  template &lt;class T&gt;
  void rmap(T &amp;t, int l){
    for(int i=0;i&lt;l;i++)t[i]=rand()%10;
  }
  template &lt;class T&gt;
  void show(T&amp; t) {
      for (auto element : t)cout &lt;&lt; element &lt;&lt; " ";
      cout &lt;&lt; endl;
  }
  template &lt;class T&gt;
  void showmap(T &amp;t){
    for(auto element:t)cout&lt;&lt;element.second&lt;&lt;" ";
    cout&lt;&lt;endl;
  }
  
  int main() {
      vector&lt;int&gt; v;
      list&lt;int&gt; l;
      multiset&lt;int&gt; s;
      map&lt;int,int&gt; m;
  
      int num = 30;
      int rtd = rand() % 10;
  
      rvec(v, num);
      rlist(l, num);
      rmset(s, num);
      rmap(m, num);
  
      show(v);
      show(l);
      show(s);
      showmap(m);
      cout &lt;&lt; endl;
  
      auto last = unique(v.begin(), v.end());
      v.resize(distance(v.begin(), last));
      l.unique();
      //something for list
      //something for map
  
      show(v);
      show(l);
      show(s);
      showmap(m);
      return 0;
  }
  </code></pre>
  
  <p>after launching I got</p>
  
  <p><code>0 0 1 1 1 1 1 2 2 2 3 3 3 3 4 5 5 5 5 5 5 6 7 7 8 8 8 8 9 9</code> for set and</p>
  
  <p><code>2 9 2 0 7 2 6 0 8 5 5 1 9 0 3 1 9 3 0 5 3 0 9 3 1 7 2 2 0 7</code> for map</p>