Boost / Phoenix

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
 
K

Kristo

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: [snip]
Can anybody help me here?

This is OT here. You'll have to direct your question to the appropriate
Boost mailing list.

Kristo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top