Maybe the template parameter should be renamed to functor or something else. In my opinion g, f or h are typical notations for functions and the code is understandable.