[Boost-bugs] [Boost C++ Libraries] #8579: qi::as/qi::attr_cast<container_type> cannot be combined with some other parsers

Subject: [Boost-bugs] [Boost C++ Libraries] #8579: qi::as/qi::attr_cast<container_type> cannot be combined with some other parsers
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-05-16 04:02:39


#8579: qi::as/qi::attr_cast<container_type> cannot be combined with some other
parsers
---------------------------------------------+------------------------------
 Reporter: Vadim Guchenko <yhw@…> | Owner: djowel
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
---------------------------------------------+------------------------------
 The following code should compile, but it doesn't. If you remove ">>
 qi::eoi" part from the rule, it compiles. There may be other parsers in
 place of qi::eoi which don't expose any attribute (qi::lit, qi::eps) - the
 code won't compile either. qi::as<vector_type> is redundant in this
 particular example, but it can do the work in a real program.

 {{{
 #include <boost/spirit/include/qi.hpp>
 #include <boost/spirit/include/qi_match.hpp>
 #include <iostream>
 #include <sstream>
 #include <vector>

 namespace qi = boost::spirit::qi;

 int main() {
     typedef std::vector<int> vector_type;
     vector_type vector;

     std::istringstream is("11 22 33");
     is >> std::noskipws >> qi::match(qi::as<vector_type>()[qi::int_ % ' ']
>> qi::eoi, vector);
 // is >> std::noskipws >> qi::match(qi::attr_cast<vector_type>(qi::int_ %
 ' ') >> qi::eoi, vector);
     assert(is);

     for (auto value : vector)
         std::cout << value << ' ';
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8579>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC