// Function with any callable type as callback
template<typename Callable, typename ...Args>
void func_with_callback(int foo, int bar, Callable&& f, Args&&... args) {
// Do something
// ...
// Invoke callback
std::forward<Callable>(f)(std::forward<Args>(args)...);
}
认证高级PHP讲师