[Bind] binding a functor simple example - compiler error

I'm having problems to compile a simple example and I don't
Know what could it be the problem.
my main.cpp code is the following:
-- main.cpp -----------------------------------------------
#include

Viter :O) wrote:
I'm having problems to compile a simple example and I don't Know what could it be the problem.
my main.cpp code is the following:
-- main.cpp ----------------------------------------------- #include
#include <iostream> int main() { struct F { int operator() (int a, int b) const { return a + b; } }; F f;
std::cout << " f: " << boost::bind(f,1,2)() << std::endl;
return 0; } -----------------------------------------------------------
Please try moving F out of main, and say something about its result type, struct F { typedef int result_type; int operator() (int a, int b) const { return a + b; } }; int main() { F f; std::cout << " f: " << boost::bind(f,1,2)() << std::endl; return 0; } HtH, Rutger
participants (2)
-
Rutger ter Borg
-
Viter :O)