Question is simple, how would I implement a function taking a variable number of arguments (alike the variadic template), however where all arguments have the same type, say
A possible solution is to make the parameter type a container that can be initialized by a brace initializer list, such as std::initializer_list
#include
#include
void func(std::initializer_list a_args)
{
for (auto i: a_args) std::cout << i << '\n';
}
int main()
{
func({4, 7});
func({4, 7, 12, 14});
}