Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I assign the result of a function object to a local in a boost::spirit semantic action
    primarykey
    data
    text
    <p>Im not really sure why the following code gives me the following error in GCC 4.6.3 </p> <p>no match for ‘operator=’ in ‘boost::spirit::_a = boost::phoenix::function::operator()(const A0&amp;) const [with A0 = boost::phoenix::actor >, F = make_line_impl, typename boost::phoenix::as_composite, F, A0>::type = boost::phoenix::composite, boost::fusion::vector, boost::spirit::argument&lt;0>, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> >]((* &amp; boost::spirit::_1))’</p> <p>Is it even possible to assign the result of a lazy function object to a qi placeholder? </p> <pre><code>#include &lt;string&gt; #include &lt;boost/spirit/include/phoenix_function.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 Sig&gt; struct result; template &lt;typename This, typename Arg&gt; struct result&lt;This(Arg const &amp;)&gt; { typedef int* type; }; template &lt;typename Arg&gt; int* operator()(Arg const &amp; content) { 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. 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