Opened 9 years ago

Last modified 9 years ago

#9114 new Bugs

Documentation examples not working

Reported by: ruslan_baratov@… Owned by: Joel de Guzman
Milestone: To Be Determined Component: spirit
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

Example of qi::phrase_parse (from this page):

// the following parses "1.0 2.0" into a pair of double
std::string input("1.0 2.0");
std::string::iterator strbegin = input.begin();
std::pair<double, double> p;
qi::phrase_parse(strbegin, input.end(),
    qi::double_ >> qi::double_,       // parser grammar 
    qi::space,                        // delimiter grammar
    p);                               

and example of qi::parse (from this page):

// the following parses "(1.0, 2.0)" into a pair of double
std::string input("(1.0, 2.0)");
std::string::iterator strbegin = input.begin();
std::pair<double, double> p;
qi::parse(strbegin, input.end(),
    '(' >> qi::double_ >> ", " >> qi::double_ >> ')', // parser grammar 
    p);

both produce compile error:

no matching function for call to 'std::pair<double, double>::pair(const double&)'

Compiled with gcc 4.7.3

Change History (1)

comment:1 by ruslan_baratov@…, 9 years ago

I've found some misprints in documentation, you can get patch from github:

github.com/ruslo/spirit/commit/2a993fe17ec8e12d75036f0c42805b943d665c1f
Note: See TracTickets for help on using tickets.