$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [phoenix] A simple lambda func as boost::function
From: Joel de Guzman (joel_at_[hidden])
Date: 2009-12-14 21:35:30
Michael Caisse wrote:
> 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?
I don't think you need the extra parens.
Regards,
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon