
1 Feb
2006
1 Feb
'06
10:04 a.m.
Daniel Lidström wrote:
Hello!
I'm trying to use Boost.Lambda to count the total number of elements in a list of lists. This example shows what I'm trying to do:
#include
#include <algorithm> #include <list> using namespace std; using namespace boost::lambda;
int main() { int count = 0; list
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 :-) This is the single biggest problem of a non-langauage solution to lambdas. -Thorsten