title: C++ std::transform() and toupper() ..why does this fail?
body: <p>I have 2 std::string. I just want to, given the input string:</p>
  
  <ol>
  <li>capitalize every letter </li>
  <li>assign the capitalized letter to the output string.</li>
  </ol>
  
  <p>How come this works:</p>
  
  <pre><code>  std::string s="hello";
    std::string out;
    std::transform(s.begin(), s.end(), std::back_inserter(out), std::toupper);
  </code></pre>
  
  <p>but this doesn't (results in a program crash)?</p>
  
  <pre><code>  std::string s="hello";
    std::string out;
    std::transform(s.begin(), s.end(), out.begin(), std::toupper);
  </code></pre>
  
  <p>because this works (at least on the same string:</p>
  
  <pre><code>  std::string s="hello";
    std::string out;
    std::transform(s.begin(), s.end(), s.begin(), std::toupper);
  </code></pre>