Using balanced BST like AVL or Red-Black-Tree, we can easily maintain a set of values that:
- Insert/delete/query given value.
- Count the elements that smaller/larger than given value.
- Find the element with rank k after sort.
All above can be archived in O(log N)
complexity.
My question is, is there any STL container supporting all 3 above operations in the same complexity?
I know STL set/multiset can be used for 1 and 2. And I examined the _Rb_tree based containers map/set/multiset, but none provides support for 3. Is there a way to subclassing ext/rb_tree to solve this?