#ifndef FUNCTOR_H #define FUNCTOR_H #include #include template struct base{ bool operator()(int i)const { return static_cast< const T&>(*this)(i); } }; struct F1:public base{ bool operator()(int i) const{ return true; } }; struct F2:public base{ bool operator()(int i) const{ return true; } }; struct F3 :public base{ std::string junk_; F3(std::string junk):junk_(junk){} bool operator()(int i) const{ std::cout << junk_ << std::endl; return false; } }; #endif