Как-то так?
class Functor
{
public:
/// type of pointer to function taking string and int and returning int
typedef int ( *func_ptr_t )( const std::string&, int );
explicit Functor( func_ptr_t f ) : fptr_( f ) {}
int operator()( const std::string& s, int i ) const { return fptr_( s, i ); }
private:
func_ptr_t fptr_; //< function pointer
};
Но почему бы просто не использовать boost::function
?Это позволяет намного больше, чем просто указатель на функцию.