title: Order in std::set and difference to std::unordered_set
body: <p>I expected the order of <code>std::set</code> to be consistent like <code>std::list</code> or <code>std::vector</code>, only that a value will not be appended a second time. MSVC 110 prooved me wrong. I expected the following code the yield the result shown below, which is the case when running the code on ideone (<a href="http://ideone.com/e47GwQ" rel="nofollow">http://ideone.com/e47GwQ</a>) (not sure which compiler and version they use, though).</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;set&gt;
  
  template &lt;typename C&gt;
  int insert_get_index(C&amp; container, typename C::value_type value)
  {
      typename C::iterator it = container.insert(value).first;
      return std::distance(container.begin(), it);
  }
  
  int main()
  {
      int a = 3, b = 1, c = 9;
      std::set&lt;int*&gt; set;
  
      std::cout &lt;&lt; insert_get_index(set, &amp;a) &lt;&lt; "\n";
      std::cout &lt;&lt; insert_get_index(set, &amp;b) &lt;&lt; "\n";
      std::cout &lt;&lt; insert_get_index(set, &amp;c) &lt;&lt; "\n";
      std::cout &lt;&lt; insert_get_index(set, &amp;a) &lt;&lt; "\n";
      std::cout &lt;&lt; insert_get_index(set, &amp;b) &lt;&lt; "\n";
      std::cout &lt;&lt; insert_get_index(set, &amp;c) &lt;&lt; "\n";
  
      return 0;
  }
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>0
  1
  2
  0
  1
  2
  </code></pre>
  
  <p>Running the code in Visual Studio 2012 yields what you can see below.</p>
  
  <pre class="lang-none prettyprint-override"><code>0
  0
  2
  1
  0
  2
  </code></pre>
  
  <p>Now, why did I thin that <code>std::set</code> behaves like described above? Because cplusplus.com states </p>
  
  <blockquote>
    <p>Sets are containers that store unique elements following a specific order.</p>
  </blockquote>
  
  <p>and additionally, there is <code>std::unordered_set</code>.</p>
  
  <ol>
  <li>Did I understand the documentation incorrectly and <code>std::set</code> is instead <strong>value ordered</strong>?</li>
  <li>And what's <code>std::unordered_set</code> for then?</li>
  <li>Is there a different standard library container that fulfils my requirements?</li>
  </ol>