title: Splitting C++ Strings Onto Multiple Lines (Code Syntax, Not Parsing)
body: <p>Not to be confused with how to split a string parsing wise, e.g.:<br>
  <a href="https://stackoverflow.com/questions/236129/how-to-split-a-string">Split a string in C++?</a></p>
  
  <p>I am a bit confused as to how to split a string onto multiple lines in c++.</p>
  
  <p>This sounds like a simple question, but take the following example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  main() {
    //Gives error
    std::string my_val ="Hello world, this is an overly long string to have" +
      " on just one line";
    std::cout &lt;&lt; "My Val is : " &lt;&lt; my_val &lt;&lt; std::endl;
  
    //Gives error
    std::string my_val ="Hello world, this is an overly long string to have" &amp;
      " on just one line";  
    std::cout &lt;&lt; "My Val is : " &lt;&lt; my_val &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>I realize that I could use the <code>std::string</code> <code>append()</code> method, but I was wondering if there was any shorter/more elegant (e.g. more pythonlike, though obviously triple quotes etc. aren't supported in c++) way to break strings in c++ onto multiple lines for sake of readability.</p>
  
  <p>One place where this would be particularly desirable is when you're passing long string literals to a function (for example a sentence).</p>