The Boost Phoenix documentation here indicates that I can create my own (lambda) arguments instead of _1
/arg1
, _2
,arg2
etc. So, starting with code like this:
#include <iostream>
#include <boost/phoenix.hpp>
int main(int argc, char *argv[]) {
std::cout << (boost::phoenix::arg_names::_1)(17) << std::endl;
return 0;
}
...which outputs 17
, I'm aiming for a first step of using myarg1
. The documentation recommends that I first #include <boost/spirit/home/phoenix/core/argument.hpp>
. Doing this (G++ 4.7.2), however, results in a series of compilation errors starting with: error: redefinition of ‘struct boost::phoenix::detail::error_expecting_arguments’.
Without the arguments.hpp file included, I notice that I can declare variables of type boost::phoenix::argument<0>
. When I try to declare a variable of the crucial type, boost::phoenix::actor< boost::phoenix::argument<0> >
, however, I again receive numerous errors; this time starting with: error: no type named ‘proto_base_expr’. How can I define my own lambda arguments?