title: Assigning a string literal to std::string
body: <p>I am aware that the following code will create an array of characters and remain in memory until the program ends:</p>
  
  <pre><code>char* str = "this is a string";
  </code></pre>
  
  <p>As for this statement, creates a local array of characters and will be freed when str goes out of scope:</p>
  
  <pre><code>char str[] = "this is a string";
  </code></pre>
  
  <p>What I'm curious is, what happens when I write it like this:</p>
  
  <pre><code>std::string str = "this is a string";
  </code></pre>
  
  <p>str should make a copy of the string in it's own memory (local), but what about the string literal itself? Will it have the lifetime of the program or will it be freed when str goes out of scope?</p>