Boost logo

Boost Users :

Subject: Re: [Boost-users] [spirit] first steps
From: Igor R (boost.lists_at_[hidden])
Date: 2010-02-18 13:19:56


> Please provide us with a minimal, self-contained piece of code we can
> compile. We have no crystal ball to see what you're doing...

Sorry, I was sure it's so basic, that there's even no need for real source-code.
Here it is:

#include <string>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>

namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
namespace phoenix = boost::phoenix;
int main()
{
        using qi::int_;
        using qi::string;
        using qi::_1;
        using ascii::space;
        using phoenix::ref;

        int i1;
        std::string s1;
        std::string source;
        std::string::iterator first = source.begin(), last = source.end();
// compiles well:
        qi::phrase_parse(first, last,
        (
                int_[ref(i1) = _1]
        )
        ,
        space);

// doesn't compile:
        qi::phrase_parse(first, last,
        (
                string[ref(s1) = _1]
        )
        ,
        space);

}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net