Help with boost functional

The following code produces errors when compiled on MSVC6:
************* Start test.cpp ************************
#include <iostream>
#include "boost/functional.hpp"
struct Foo
{
int operator()(int x) const {return x+1;}
};
typedef class boost::const_mem_fun1_t

//This works //std::cout << boost::bind2nd<FType>(boost::mem_fun(&Foo::operator ()), 7)(&foo) << "\n";
I strongly suggest that you use: boost::bind(&Foo::operator(), _1, 7)(&foo);
//This does not. std::cout << boost::bind2nd(boost::mem_fun(&Foo::operator ()), 7)(&foo) << "\n";
I am just not seeing where the ambiguity is coming from. The commented out line will actually compile and run as I expected, but I can't figure out why the compiler can't deduce the template argument. Any ideas?
Thanks in Advance!
You want to use Boost.Bind. Really. Most of boost/functional.hpp should probably be deprecated (along with boost/compose.hpp), because Bind is superior in almost every aspect. Doug
participants (2)
-
Carl Waldbieser
-
Douglas Gregor