map.end() error "iterator not dereferenceable" c++ : <pre><code>//Works    
cout &lt;&lt; "map[0] value is " &lt;&lt; doubleStatsMap.begin()-&gt;first&lt;&lt; endl;
//gives error
cout &lt;&lt; "map[last value is " &lt;&lt; doubleStatsMap.end()-&gt;first &lt;&lt; endl;
</code></pre>

<p>Im simply trying to get the value of the last element of my map. It works correctly with
 "map.begin->first" 
but is giving "map/set iterator not dereferencable" for the
 "map.end()->first".
 It cant be empty as the map has a beginning thus it has an end. Everything I've read says this should work. Any suggestions greatly appreciated!</p>
