|
Boost : |
From: Brian Braatz (brianb_at_[hidden])
Date: 2004-10-09 14:59:49
I have searched the list archive and have not found anything on this
subject.
I have what looks like to be an issue with MSVC7.1 and unnamed
namespaces
(the _1 _2 and _3 are in unnamed namespaces in boost::lambda)
See below:
#include <boost/bind.hpp>
#include <boost/Lambda/lambda.hpp>
// adding my code to the boost::lambda namespace
// below works fine
namespace boost
{
namespace lambda
{
void MyFunction()
{
using namespace std;
list<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
v.push_back(5);
// Line below works
for_each(v.begin(), v.end(), std::cout << _1 <<
' ');
}
}
}
// Now global namespace
void MyFunction()
{
using namespace std;
using namespace boost;
using namespace boost::lambda;
list<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
v.push_back(5);
// Line below fails with a "error C2872: '_1' : ambiguous
symbol"
for_each(v.begin(), v.end(), std::cout << _1 << ' ');
// This line DOES work
for_each(v.begin(), v.end(), std::cout << boost::lambda::_1 << '
');
}
Has anyone else run into this? Also- I do not have the current CVS tree
handy (I am using 1.31), is this a problem on 1.32? If it is
workedaround in some fashion, I can just qualify every _1 and _2 until
1.32 comes out.
Thanks for any help or suggestions
Brian Braatz
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk