title: Why are std::begin and std::end "not memory safe"?
body: <p>In <a href="http://ericniebler.com/2018/12/05/standard-ranges/" rel="noreferrer">this blog post</a>, Eric Niebler states that: </p>
  
  <blockquote>
    <p>What is wrong with std::begin and std::end? Surprise! they are not
    memory safe. Consider what this code does:</p>
  
  <pre><code>extern std::vector&lt;int&gt; get_data();
  auto it = std::begin(get_data());
  int i = *it; // BOOM
  </code></pre>
    
    <p>std::begin has two overloads for const and non-const lvalues. Trouble
    is, rvalues bind to const lvalue references, leading to the dangling
    iterator it above.</p>
  </blockquote>
  
  <p>I'm having trouble understanding his point and why <code>it</code> is a dangling reference.
  Could someone explain?</p>