title: C++: How to iterate over a text in a std::string line by line with STL?
body: <p>I have a text in a std::string object. The text consists of several lines. I want to iterate over the text line by line using STL (or Boost). All solutions I come up with seem to be far from elegant. My best approach is to split the text at the line breaks. Is there a more elegant solution?</p>
  <p>UPDATE: This is what I was looking for:</p>
  <pre><code>std::string input;
  // get input ...
  std::istringstream stream(input);
  std::string line;
  while (std::getline(stream, line)) {
    std::cout &lt;&lt; line &lt;&lt; std::endl;
  }
  </code></pre>