I have an interface wherein the types of the parameters mostly encode their own meanings. I have a function that takes one of these parameters. I'm trying to make a function that takes a set of these parameters and performs the function on each one in order.
#include <iostream>
#include <vector>
enum param_type{typeA,typeB};
template <param_type PT> struct Container{
  int value;
  Container(int v):value(v){}
};
int f(Container<typeA> param){
  std::cout<<"Got typeA with value "<<param.value<<std::endl;
  return param.value;
}
int f(Container<typeB> param){
  std::cout<<"Got typeB with value "<<param.value<<std::endl;
  return param.value;
}
My current solution uses a recursive variadic template to delegate the work.
void g(){}
template <typename T,typename...R>
void g(T param,R...rest){
  f(param);
  g(rest...);
}
I would like to use a packed parameter expansion, but I can't seem to get that to work without also using the return values. (In my particular case the functions are void.)
template <typename...T> // TODO: Use concepts once they exist.
void h(T... params){
  // f(params);...
  // f(params)...;    // Fail to compile.
  // {f(params)...};
  std::vector<int> v={f(params)...}; // Works
}
Example usage
int main(){
  auto a=Container<typeA>(5);
  auto b=Container<typeB>(10);
  g(a,b);
  h(a,b);
  return 0;
}
Is there an elegant syntax for this expansion in C++?