Use std::function instead of a templated functor.