title: Is it legal to modify the result of std::string::op[]?
body: <p>Consider the following from C++11:</p>
  
  <blockquote>
    <p><code>[C++11: 21.4.5]:</code> <strong><code>basic_string</code> element access &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [string.access]</strong></p>
  
  <pre><code>const_reference operator[](size_type pos) const;
  reference       operator[](size_type pos);
  </code></pre>
    
    <p><sup>1</sup> &nbsp; &nbsp; <em>Requires:</em> <code>pos &lt;= size()</code>.</p>
    
    <p><sup>2</sup> &nbsp; &nbsp; <em>Returns:</em> <code>*(begin() + pos)</code> if <code>pos &lt; size()</code>, otherwise a reference to an object of type <code>T</code> with value <code>charT()</code>; the referenced value shall not be modified.</p>
    
    <p><sup>3</sup> &nbsp; &nbsp; <em>Throws:</em> Nothing.</p>
    
    <p><sup>4</sup> &nbsp; &nbsp; <em>Complexity:</em> constant time.</p>
  </blockquote>
  
  <p>This means either:</p>
  
  <ul>
  <li>The referenced value in the <code>pos == size()</code> case shall not be modified, or</li>
  <li>In <em>any</em> case, the referenced value returned by <code>op[]</code> shall not be modified, even for the non-<code>const</code> overload.</li>
  </ul>
  
  <p>The second scenario seems completely ridiculous, but I think it's what the wording most strongly implies.</p>
  
  <p><strong>Can we modify what we get from <code>std::string::op[]</code>, or not?</strong> And is this not rather ambiguous wording?</p>