how can I explicitly specify the lambda namespace

hi * In the documentation for lambda library from boost_1_33_1, in section "Getting Started"->"Conventions used in this document" said that in all examples implicitly used such declarations: using namespace std; using namespace boost::lambda; So the following will work: for_each(a.begin(), a.end(), std::cout << _1 << ' '); But how do I have to rewrite the above line of code to have it compiled without "using namespace boost::lambda;" before it? Thanks in advance.

On 14/03/07, Dmitriy Chumack
hi *
In the documentation for lambda library from boost_1_33_1, in section "Getting Started"->"Conventions used in this document" said that in all examples implicitly used such declarations:
using namespace std; using namespace boost::lambda;
So the following will work:
for_each(a.begin(), a.end(), std::cout << _1 << ' ');
But how do I have to rewrite the above line of code to have it compiled without "using namespace boost::lambda;" before it?
Thanks in advance.
This isn't really a boost question, but: boost::lambda::for_each(a.begin, a.end(), std::cout<< _1 << ''); should work.

Darren Garvey (14.3.2007 14:43):
On 14/03/07, Dmitriy Chumack
wrote: hi *
In the documentation for lambda library from boost_1_33_1, in section "Getting Started"->"Conventions used in this document" said that in all examples implicitly used such declarations:
using namespace std; using namespace boost::lambda;
So the following will work:
for_each(a.begin(), a.end(), std::cout << _1 << ' ');
But how do I have to rewrite the above line of code to have it compiled without "using namespace boost::lambda;" before it?
Thanks in advance.
This isn't really a boost question, but: boost::lambda::for_each(a.begin, a.end(), std::cout<< _1 << ''); should work. Huh, does it work for you? It does not for me.
for_each(a.begin(), a.end(), std::cout << boost::lambda::_1 << ' '); does. And since the OP is "using namespace std;", it's ok to use for_each(a.begin(), a.end(), cout << boost::lambda::_1 << ' '); Cheers, Filip

lambda doesn't provide for_each.
std::for_each(b,e,std::cout<< boost::lambda::_1 << '');
-----Original Message-----
From: boost-users-bounces@lists.boost.org on behalf of Darren Garvey
Sent: Wed 3/14/2007 6:43 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] how can I explicitly specify the lambda namespace
On 14/03/07, Dmitriy Chumack
for_each(a.begin(), a.end(), std::cout << _1 << ' ');
But how do I have to rewrite the above line of code to have it compiled without "using namespace boost::lambda;" before it?
Thanks in advance.
This isn't really a boost question, but: boost::lambda::for_each(a.begin, a.end(), std::cout<< _1 << ''); should work.
participants (4)
-
Darren Garvey
-
Dmitriy Chumack
-
Filip Konvička
-
Sohail Somani