As you know, I am a Chinese and according to my knowledge few book in Chinese introduce boost library. I only have the book " Beyond the C++ Standard Library: An introduction to boost" (written by Bjoern Karlsson, translated in Chinese).Only several pages said about lambda. I tried to ask
www.csdn.net( a Chinese developers' net) and few people answered my questions. I have not studied the source code of lambda yet. So all I have to do is to ask
www.boost.org to get answers and go forth.
I think the var(switchvalue) is a pointer to a function from the example code in the book:
..........
std::for_each(vec.begin(),vec.end(),var(m)=_1);
..............
So the operations in m can be performed. Am I right?
But I do not know how to save the values in lambda expression.
Thanks a lot.
在2009-07-09,"Steven Watanabe" <watanabesj@gmail.com> 写道:
>AMDG
>
>fmingu wrote:
>> I am using Dev-C++ with boost lambda expression, I wrote:
>> ....................
>> int nnumber;
>> int switchvalue;
>> typedef std::map<int, int> IIPrimemap;
>> IIPrimemap primemapvec;
>> # define BetaKGre2 1
>> # define EqualToOne 2
>> #define ProductOfKPrime 3
>> .....................
>> if_then_else(var(nnumber)==1,var(switchvalue)=EqualToOne,
>> if_then_else(constant(count_if(primemapvec.begin(),primemapvec.end(),
>> bind(&IIPrimemap::value_type::second,_1)>2)>0),
>> var(switchvalue)=BetaKGre2,var(switchvalue)=ProductOfKPrime));
>> std::cout<<" the var(switchvalue) is "<<var(switchvalue)<<"\n";
>> ..............
>> and the program ran and showed:
>> the var(switchvalue) is
>>
>> without any expression of var(switchvalue).
>> I do not know how to save the values in lambda expression and where is wrong?
>> Can I use *var(switchvalue) instead of var(switchvalue)?
>> Can anyone with kindness help me?
>>
>
>Think about it. What exactly is var(switchvalue)?
>What does std::cout << var(switchvalue) do?
>
>In Christ,
>Steven Watanabe
>
200万种商品,最低价格,疯狂诱惑你