I am looking for something like that:
template< typename T>
void func(T t)
{
}
template< typename... Parms>
void anyFunc( Parms... p)
{
func<Parms>(p)... ; //error
func(p)... ; //error
}
If the parameter pack expansion is done inside another function call it works:
template< typename T>
int some(T t)
{}
template< typename... Parms>
void func(Parms ...p)
{}
template< typename... Parms>
void somemore(Parms... p)
{
func( some(p)...);
}
int main()
{
somemore(1,2,3,4,10,8,7, "Hallo");
}
The parameter pack expansion will also work for a list of base class initializers.
Is there any solution which will also work for functions which will return 'void'. The above workaround will not, while using the function calls returning void inside a parameter list could never work.
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…