F
FBergemann
Hi,
I wanted to start some samples with phonenix - but it doesn't work.
(a polymorphic add function)
Because of problems i cut it back and wanted to do just simple
"reflection" 1st.
But i have to admit, that even this didn't work:
#include <iostream>
#include <boost/spirit/phoenix/operators.hpp>
#include <boost/spirit/phoenix/functions.hpp>
#include <boost/spirit/phoenix/primitives.hpp>
using namespace std;
using namespace phoenix;
struct adding_ {
template <typename ArgT>
struct result { typedef ArgT type; };
template <typename ArgT>
ArgT operator()(ArgT arg1)
{ return arg1; }
};
function<adding_> adding;
nt main (int argc, char **argv)
{
int a = 1;
int b = 2;
int c = adding(a);
return 0;
}
But when compilint (linux, g++) i got:
frank@linux:~/project/C++/boost/phoenix> c++
-I/usr/local/include/boost-1_32/ -o sample2 sample2.cc
sample2.cc: In function `int main(int, char**)':
sample2.cc:30: error: cannot convert `
phoenix::actor<phoenix::composite<adding_,
phoenix::actor<phoenix::value<int> >, phoenix::nil_t,
phoenix::nil_t,
phoenix::nil_t> >' to `int' in initialization
Can anybody help me here?
- Thanks in advance!
Frank Bergemann
I wanted to start some samples with phonenix - but it doesn't work.
(a polymorphic add function)
Because of problems i cut it back and wanted to do just simple
"reflection" 1st.
But i have to admit, that even this didn't work:
#include <iostream>
#include <boost/spirit/phoenix/operators.hpp>
#include <boost/spirit/phoenix/functions.hpp>
#include <boost/spirit/phoenix/primitives.hpp>
using namespace std;
using namespace phoenix;
struct adding_ {
template <typename ArgT>
struct result { typedef ArgT type; };
template <typename ArgT>
ArgT operator()(ArgT arg1)
{ return arg1; }
};
function<adding_> adding;
nt main (int argc, char **argv)
{
int a = 1;
int b = 2;
int c = adding(a);
return 0;
}
But when compilint (linux, g++) i got:
frank@linux:~/project/C++/boost/phoenix> c++
-I/usr/local/include/boost-1_32/ -o sample2 sample2.cc
sample2.cc: In function `int main(int, char**)':
sample2.cc:30: error: cannot convert `
phoenix::actor<phoenix::composite<adding_,
phoenix::actor<phoenix::value<int> >, phoenix::nil_t,
phoenix::nil_t,
phoenix::nil_t> >' to `int' in initialization
Can anybody help me here?
- Thanks in advance!
Frank Bergemann