|
Boost Users : |
Subject: Re: [Boost-users] [phoenix] A simple lambda func as boost::function
From: Michael Caisse (boost_at_[hidden])
Date: 2009-12-14 21:33:02
Richard Vock wrote:
>> 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;
>> }
>>
>
> This is very interesting, since exactly this code won't
> compile with my setup (error message looks very close to
> the one I supplied in my second post):
> g++ (GCC) 4.4.2
> BOOST_VERSION 103900
> BOOST_PHOENIX_VERSION 0x2000 // 2.0.0
>
>
I've now tried it with the following two combos:
OS Compiler Boost Version Phoenix Version
windows vc8 1_41_0 0x2000
linux g++_4.3.2 1_39_0 0x2000
Works fine for me. I only have gcc_4.3.2 on the virtual machine
I was using. I'll reboot into linux later and check 4.4.2...
but meanwhile, can you paste the error that you get with
your setup and the source above?
michael
-- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net