title: How to use boost::spirit to parse a sequence of words into a vector?
body: <p>I'm trying to learn <code>boost::spirit</code>. As an example, I'm trying to parse a sequence of words into a <code>vector&lt;string&gt;</code>. I tried this: </p>
  
  <pre><code>#include &lt;boost/spirit/include/qi.hpp&gt;
  #include &lt;boost/foreach.hpp&gt;
  
  namespace qi = boost::spirit::qi;
  
  int main() {
  
    std::vector&lt;std::string&gt; words;
    std::string input = "this is a test";
  
    bool result = qi::phrase_parse(
        input.begin(), input.end(),
        +(+qi::char_),
        qi::space,
        words);
  
    BOOST_FOREACH(std::string str, words) {
      std::cout &lt;&lt; "'" &lt;&lt; str &lt;&lt; "'" &lt;&lt; std::endl;
    }
  }
  </code></pre>
  
  <p>which gives me this output: </p>
  
  <pre><code>'thisisatest'
  </code></pre>
  
  <p>but I wanted the following output, where each word is matched separately:</p>
  
  <pre><code>'this'
  'is'
  'a'
  'test'
  </code></pre>
  
  <p>If possible, I'd like to avoid having to define my own <code>qi::grammar</code> subclass for this simple case.</p>