title: Unable to erase from libstdc++ Policy based data structure
body: <p>There is an associated container in C++ which is actually a set (multiset) which can give the order of an element in it in.</p>
  
  <p>Here is how I use the container:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;bits/stdc++.h&gt;
  #include &lt;ext/pb_ds/assoc_container.hpp&gt;
  
  using namespace std;
  using namespace __gnu_pbds;
  
  template &lt;typename T&gt;
  using ordered_multiset = tree&lt;T, null_type, less_equal&lt;T&gt;, rb_tree_tag,
                                tree_order_statistics_node_update&gt;;
  </code></pre>
  
  <p>The problem is, I am not able to erase an element from it:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>ordered_multiset&lt;int&gt; s;
  s.insert(0);
  s.erase(0);
  
  cout &lt;&lt; s.order_of_key(1); // returns number of elements less than x
  
  // Outputs: 1
  </code></pre>
  
  <p>The strange part is that if you replace <code>less_equal</code> with <code>less</code>, then you would be able to do the job without a problem, actually if you use the container as a multiset, then you won't be able to erase elements from it, but there is no problem when you use it as a set.</p>
  
  <ul>
  <li>What is causing the problem?</li>
  <li>How can I solve the problem?</li>
  </ul>
  
  <p><strong>Note: Please don't suggest solving the problem in way of using another container. That's not a solution.</strong></p>