Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have fixed some spots in the code to make it compile:</p> <ul> <li><p>I rewrote the nested <code>::result&lt;&gt;::type</code> logic according to the documentation of <a href="http://www.boost.org/doc/libs/1_49_0/libs/utility/utility.htm#result_of" rel="nofollow">BOOST_RESULT_OF</a>.</p> <p><strong>Note</strong> if you compile in c++11 mode, you're probably better off defining</p> <pre><code> #define BOOST_RESULT_OF_USE_DECLTYPE </code></pre> <p>in which case you don't have to bother with the nested result type template.</p></li> <li><p>The <code>operator(...)</code> method needed to be const</p></li> </ul> <p>Resulting code:</p> <pre><code>#include &lt;string&gt; #include &lt;boost/spirit/include/phoenix.hpp&gt; #include &lt;boost/spirit/include/qi.hpp&gt; using std::string; using boost::spirit::qi::grammar; using boost::spirit::qi::rule; using boost::spirit::qi::space_type; using boost::spirit::qi::skip_flag; using boost::spirit::unused_type; namespace qi = boost::spirit::qi; namespace phx = boost::phoenix; struct make_line_impl { int* _context; make_line_impl(int* context) { _context = context; } template &lt;typename Arg&gt; struct result { typedef int* type; }; template &lt;typename Arg&gt; int* operator()(Arg const &amp; content) const { return new int(5); } }; template&lt;typename Iterator&gt; struct MyGrammar : grammar&lt;Iterator, unused_type, space_type&gt; { rule&lt;Iterator, unused_type, space_type&gt; start; rule&lt;Iterator, int*(), space_type&gt; label; rule&lt;Iterator, string*(), qi::locals&lt;int*&gt;, space_type&gt; line; MyGrammar() : MyGrammar::base_type(start) { make_line_impl mlei(new int(5)); phx::function&lt;make_line_impl&gt; make_line(mlei); start = *(line); line = label[qi::_a = make_line(qi::_1)]; } }; int main(int argc, char **argv) { string contents; qi::phrase_parse(contents.begin(), contents.end(), MyGrammar&lt;string::iterator&gt;(), space_type(), skip_flag::postskip); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload