0

I have a difficult time wrapping my head around the following:

int main( int, char *[] )
{
    const string test( "1 2" );
    typedef string::const_iterator iterator;

    auto desired = []( int a, int b )
    {
    };

    auto working = []( boost::fusion::vector2<int,int> )
    {
    };

    iterator i = test.begin( );
    qi::phrase_parse( i, test.end( ),
                     (
                      qi::int_ >>
                       qi::int_
                      )
                     [ working ]
//                   [ ph::bind( desired, qi::_1, qi::_2 ) ]
                     , qi::ascii::space );

    return test.end( ) - i;
}

I know it's mostly code, but I think it's self explanatory; 'working' callback is fine, but if I comment it out in favour of the desired line, compiler says no, using the following words:

/opt/local/include/boost/spirit/home/phoenix/core/detail/function_eval.hpp:115:30: 'result' following the 'template' keyword does not refer to a template

/opt/local/include/boost/mpl/eval_if.hpp:38:22: Type 'f_' (aka 'int') cannot be used prior to '::' because it has no members

/opt/local/include/boost/spirit/home/support/action_dispatch.hpp:178:13: No matching function for call to object of type 'const phoenix::actor, vector >, argument<0>, argument<1>, void_, void_, void_, void_, void_, void_, void_> > >'

I've tried phoenix::bind, boost::bind, writing my own wrapper... No success. Well, my own wrapper did work, but not templated ones, so that was useless, and I think it's phoenix' job anyway.

any help would be appreciated!

Arjan
  • 484
  • 3
  • 11
  • 1
    [It works on Coliru](http://coliru.stacked-crooked.com/a/efc1d8b0b13d3408)(clang++ 3.4.2 and Boost 1.56). I'd recommend defining BOOST_SPIRIT_USE_PHOENIX_V3 (this is the default in 1.56) and maybe BOOST_RESULT_OF_USE_DECLTYPE (only if needed). – llonesmiz Aug 30 '14 at 07:46
  • Ah great.. BOOST_SPIRIT_USE_PHOENIX_V3 fixed it! Thanks! – Arjan Aug 30 '14 at 08:21

0 Answers0