use boost::function and boost::bind instead of template