[Boost.Lambda] for_each and cout using placeholder
Hi Folks, What's wrong with the following simple approach: ---- Start code ---- using boost::lambda; int a[10] std::for_each(a, a+10, std::cout << _1); ---- End code ---- It doesn't compile. What am I missing here? Thanks, -- - Kobi
On Fri, 7 Dec 2007 09:35:47 -0800
"Kobi Cohen-Arazi"
Hi Folks,
What's wrong with the following simple approach:
---- Start code ----
using boost::lambda;
Try: using namespace boost::lambda;
int a[10]
You forgot a semicolon: int a[10];
std::for_each(a, a+10, std::cout << _1);
---- End code ----
It doesn't compile. What am I missing here?
If it doesn't compile with this, please copy the error text so we can help you.
OTOH, this complete example works for me:
---- Start code ----
#include
Thanks, -- - Kobi
HTH, Raul.
If it doesn't compile with this, please copy the error text so we can help you.
OTOH, this complete example works for me:
---- Start code ---- #include
Actually, thats the only line was missing. (The semicolon and "using" was actually OK). Just the include was missing. I thought lambda/bind.hpp would be enough, but apparently not. Thanks for the help! Kobi.
participants (2)
-
Kobi Cohen-Arazi
-
raulh39@ya.com