title: std::set operations with custom comparator
body: <p>I have a question. When I'm using a std::set with custom comparator, other operations like erase or count doesn't work properly.
  For example:</p>
  
  <pre><code>int sz(int const &amp; n) {
    return __builtin_popcount(n);
  }
  
  struct comp {
    bool operator()(int const &amp; a, int const &amp; b) const {
      return sz(a) &gt;= sz(b);
    }
  };
  
  void solve() {
    set&lt;int, comp&gt; s;
  
    for (int i = 0; i &lt; 10; ++i)
      s.insert(i);
  
    for (int x : s)
      cerr &lt;&lt; x &lt;&lt; " ";
  
    cerr &lt;&lt; "\n";
  
    for (int i = 0; i &lt; 10; ++i)
      cerr &lt;&lt; s.count(i) &lt;&lt; " ";
  }
  </code></pre>
  
  <p>Output will be:</p>
  
  <pre><code>7 9 6 5 3 8 4 2 1 0
  0 0 0 0 0 0 0 0 0 0
  </code></pre>
  
  <p>How I might use std::set with custom comparator, that all operations work properly?
  Thanks in advance.</p>