No. I was looking for him.
There is a way you can implement this. Start with a binary tree or skip list and save the subtree / skip size (a bit of extra overhead - when the elements are inserted, you need to go back to the parents / skip and increment, and similarly for deletions).
Then you can get indexes at lg n time, random access (by index or offset) at lg n time and save it at the same time.
My attempts to find a pre-written container that did this were fruitless, and the project was mothballed, so I did not write it.
You can use a full database with an indexed sorted column, and you could get a number less than reasonably fast.
Coefficients, if a simple linear sorted vector is not reasonable (with its expensive insert in the middle), you can generally consider the database.
As an example of a container that looks promising but failed, the Boost MultiIndex container allows you to index a container in several ways, but sequential and ordered indexes are independent. Thus, you can indicate which order you entered the item, and where it goes before / after in sorting, but not the index that it has in sorting.
source share