Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-02-01 08:30:37


Thorsten Ottosen wrote:
> Daniel Lidström wrote:

>> int main()
>> {
>> int count = 0;
>> list<list<int> > ll;
>> for_each(ll.begin(), ll.end(), var(count)+=(_1).size());
>> }
>>
>> This will not compile: (13): error C2039: 'size': is not a member of
>> 'boost::lambda::lambda_functor<T>'
>> Is this possible to do?
>
> AFAICT, no. Not unless the type of _1 implements all possible member
> functions in the world :-)

    for_each( ll.begin(), ll.end(), count += bind( &list<int>::size, _1 ) );

works for me.


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