
Richard Vock wrote:
Hehe, I already tried that and it gives me this handy little error message: http://pastebin.com/m787325af
Essentially telling me something I don't understand at all about boost::phoenix::at not being a function...
Please don't top post.
Richard Vock wrote:
Hi boost gurus,
after some time and a lot of pain I somehow managed to work with boost.lambda in a way that actually outweighs the costs (code elegance versus time spent compiling it), but I miss some features (like local variables) I see in that cute phoenix documentation and a lot of mailing list threads which all seem to propose using phoenix rather than lambda (and it indeed looks a lot better).
But whenever I try to use it, I somehow fail at the most simple tasks. Take for example this minimalistic code example here (note the use of #define USE_LAMBDA): http://pastebin.com/m3f590a01
Both versions (with and without USE_LAMBDA defined)
compile
well on the most recent stable g++ compiler, but the phoenix version does not output anything. Not at all. Also note, that this exact lambda expression is mentioned here: http://tinyurl.com/ybmp2lw (well, without the << "\n" but that doesn't change the problem)
Could someone please enlighten me by telling me what I
This works for me and I think it is what you are after. Am I missing something? (btw ... notice that the int in the function sig is by value ... not reference) -------------------------------- #include <iostream> #include <boost/spirit/include/phoenix.hpp> #include <boost/function.hpp> void my_func( boost::function< void(int) > func ) { for( int i=0; i<5; ++i ) { func( i ); } } int main() { using boost::phoenix::arg_names::arg1; my_func( (std::cout << arg1 << '\n') ); return 0; } ---------------------------------- regards - michael -- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com