[lambda] Correct way to use lamda with boost.array?

What is the proper syntax for using lamda with with array? i.e. how do I do something like namespace lambda = ::boost::lambda; boost::array< boost::array<int,2>, 4 > foo = {{ {-1,1}, {0,0}, {1,-1}, {2,-2} }}; std::for_each( foo.begin(), foo.end(), std::cout << lambda::constant( "first = " ) << lambda::_1[0] << ' ' << lambda::constant( "second = " ) << lambda::_1[1] << '\n' ); Thanks

Hi, I've had the same problems (with vectors of arrays). Unfortunately, the only workaround I've found is (for example): for_each(b,e,lambda::ret<T&>(_1[0])=5); It sometimes makes the lines really long, for example if you're doing a sort based on different columns of your table, but its still better than the alternative (syntatically) -----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Michael Marcin Sent: Wed 8/9/2006 12:10 PM To: boost-users@lists.boost.org Subject: [Boost-users] [lambda] Correct way to use lamda with boost.array? What is the proper syntax for using lamda with with array? i.e. how do I do something like namespace lambda = ::boost::lambda; boost::array< boost::array<int,2>, 4 > foo = {{ {-1,1}, {0,0}, {1,-1}, {2,-2} }}; std::for_each( foo.begin(), foo.end(), std::cout << lambda::constant( "first = " ) << lambda::_1[0] << ' ' << lambda::constant( "second = " ) << lambda::_1[1] << '\n' ); Thanks _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Michael Marcin
-
Sohail Somani