I am trying to use std::function to achieve this (code does not compile, ofc):
template <typename Duration>
void operation1(int i)
{
    // do some chrono stuff
}
template <typename Duration>
void operation2(int i)
{
    // do other chrono stuff
}
void callFunc(const std::function<void(int)>& func, int i)
{
    func<std::chrono::hours>(i);
    func<std::chrono::minutes>(i);
    func<std::chrono::seconds>(i);
    func<std::chrono::milliseconds>(i);
}
int main()
{
    callFunc(operation1, 10);
    callFunc(operation2, 5);
}
The problem seems to be the fact that functions operations1 and operations2 are templatized and I don't know how to call them. If I remove the template, everything works ok.
I am open to other suggestions to use make the function callFunc a template if it works.
https://godbolt.org/z/cq5b1ozjP
Thank you
P.S. I know that calling callFunc(operation1<std::chrono::hours>, 10); works, but this does not help me, I am trying to get rid of duplicating code, otherwise I can delete the callFunc and use directly operation1 and operation2, like I am doing now...