-3
You're using your class wrong.. You're actually calling the operator() on the same line as the declaration.. To fix it you can do: #include <iostream> #include <string> #include <map> using namespace std; class functor { public: void operator()(int i) { cout << i