title: unique STL container with special ordering
body: <p>I have a need for a STL container which is capable of:</p>
  
  <p><strong>1) only storing unique items</strong></p>
  
  <p><strong>2) has a guaranteed order based on when item was added to the container</strong></p>
  
  <p>So, if I add items A, B, and C to my container in that order, </p>
  
  <p><strong>A</strong> will always be accessible via: <code>myItems().begin()</code> or <code>myItems[0]</code></p>
  
  <p><strong>B</strong> will always be accessible via:
  <code>myItems.begin() + 1</code> or <code>myItems[1]</code></p>
  
  <p><strong>C</strong> will always be accessible via:
  <code>myItems.begin() + 2</code> or <code>myItems[2]</code></p>
  
  <p>I am currently using an <code>unordered_set</code> which does not fulfill need #2. If I use a regular <code>set</code>, I can specify a less than function for ordering but the ordering may change as new items are added to the container.</p>
  
  <p>Using a regular <code>set</code>, if I insert a new item D which is less than A, A will no longer be accessible via <code>myItems.begin()</code>. I could be wrong but that is my understanding of how set ordering works.</p>
  
  <p>If I use a <code>list</code>, I can enforce the unique aspect by calling <code>list::unique()</code> after inserting every new item:</p>
  
  <pre><code>myList.sort();
  myList.unique();
  </code></pre>
  
  <p>or I could use <code>std::find</code> with a list or a vector and manually enforce the unique aspect: </p>
  
  <pre><code>iter = std::find(myList.begin(), myList.end(), item);
  
  //Only add item if not already in list/vector...
  if(iter == myList.end())
  {
      myList.push_back(item);
  }
  </code></pre>
  
  <p>Is there a better container/solution for my particular needs?</p>