title: Sorted data structure fast iteration, insertion, deletion by iterator
body: <p>I am looking for a data structure that has the following properties:</p>
  
  <ul>
  <li>Sorted(unless this is not needed for sorted order iteration)</li>
  <li>O(1) iteration in the sorted order.</li>
  <li>Fast insertion. I would think O(lg(n)) is the way to go.</li>
  <li>Fast deletion <code>using an iterator</code>. I am hoping for at least the same speed as insertion. I will never have to delete an item by value, and will always have the iterator available. This requirement means insertion and iteration will never invalidate iterators, unless deletion by value happens at the same speed as deletion by iterator.</li>
  </ul>
  
  <p>Anything else is not relevant and will never be used.</p>
  
  <p>After searching around for a while I was not able to find a data structure that follows these properties. A heap allows for fast insertion and removal(althought not by iterator per se), but is not easy to iterate in the required way.</p>
  
  <p>I have also looked at a sorted vector. This has fast insertion and correct iteration, but deletion is pretty hard there.</p>
  
  <p>I would say this is a pretty common data structure, even though I was not able to find a matching structure. Furthermore I think the fact that I always have an iterator when deleting might improve the performance.</p>
  
  <p>I hope you can help me in the right direction.</p>