Is it possible to pass a function that takes a function pointer with a template argument? So for example I would like to have a function that may look something like this:
template<template<int I> typename Func>
void funcCaller(Func<I> func)
{
func<1>();
func<2>();
func<10>();
}
and ideally could be used like this
template<int I>
void test()
{
std::cout << I << std::endl;
}
funcCaller(test);
Now this doesn't compile, and a realize I am not using the templates in funcCaller correctly. Honestly I'm not even sure if what I am going for is possible, and it sure seems like a streach for the compiler to figure this out. I also don't want to specify the function signature, and the use case I have in mind would use this with a variadic-template, where funcCall acts as a loop of sorts that could operate a variety of functions.
Any thoughts on how to approach something like this? Any direction is much appreciated :)
If this is answered elsewhere I would love to know, and figure out what terminology I am missing.