August 2017
Intermediate to advanced
438 pages
14h 19m
English
A very interesting variable here is boost::spirit::qi::rule<const char*, void()>. It erases the exact type of a resulting parser and allows you to write parsers for recursive grammars. It also allows you to write parsers in source files and export them to headers without significantly affecting compilation times of your project. For example:
// Somewhere in header file class example_1 { boost::spirit::qi::rule<const char*, void()> some_rule_; public: example_1(); }; // In source file example_1::example_1() { some_rule_ = /* ... a lot of parser code ... */; }
Note that this class implies optimization barrier for compilers, so do not use it when it is not required.
Sometimes we used >> ':' instead of >> char_(':'). The ...
Read now
Unlock full access