I had a simpler solution, remove the #include boost/bind.hpp
it was some old stuff that hadn't panned out, but the #include never got removed.
this causes a small amount of grief trying to find it, since I couldn't remember it being used at all... and it wasn't, but the #include was still in one of the header files.
At Friday 2003-08-08 03:16, you wrote:
Victor A. Wagner, Jr. wrote:
> I finally had a chance to go back and look at an attempt to use lambda in > one of my commercial endeavors. It turns out that I was getting "ambiguous > _1" with my compiler (VC.net2003) between lambda and bind.
Boost.lambda places _1 in the boost::lambda namespace. Boost.bind places _1 in the global namespace. This is fine so long as you avoid using directives and are careful with using declarations.
As soon as you have a using directive for the boost::lambda namespace, boost::lambda::_1 will be injected into the global namespace -- even if the using directive is at block scope -- and any use of _1 will be ambiguous.
If you have translation units that use both Boost.bind and Boost.lambda, the safest advice is (i) avoid all using directives for namespace boost::lambda; (ii) put using declarations at block scope. For example,
int main() { boost::function< int (int, int) > times; { using boost::lambda::_1; using boost::lambda::_2; times = _1 * _2; }
boost::function< int (int) > square ( boost::bind( times, _1, _1 ) );
std::cout << times(10,20) << std::endl; std::cout << square(9) << std::endl; }
-- Richard Smith _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law"
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost