需要实现一个在线插入、删除、求 rank 的东西。我使用了 set,为了查询 rank 我是这么写的:
st.lower_bound(val)-st.begin();
然后它报错了,查了下发现 set 的迭代器不能用减法。
求问,如果我硬要用 set 要怎么写?