title: How to find min/max in std::map like in std::set?
body: <p>Since both set and map are ordered containers, can the min and the max be found in 0(1) time for std::map like in std::set ? </p>
  
  <pre><code>// for std::set
  // std::set&lt;int&gt; s;
  auto min = *s.begin();
  
  auto max = *s.rbegin();
  </code></pre>
  
  <p>How do I obtain the max and min in O(1) from a std::map ? Other questions here seem to suggest to iterate through the map, but can't we use the ordered properlt of std::map to obtain the result faster ? </p>