|
Boost Users : |
From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-08-09 19:20:42
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_at_[hidden] on behalf of Michael Marcin
Sent: Wed 8/9/2006 12:10 PM
To: boost-users_at_[hidden]
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_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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