Imagine we have a variadic function void foo(T args...)
for an existing type T.
In Java (void foo(T... args)
) and C# (void foo(params T[] args)
) passing an array of type T T[]
is a valid way to pass it's contents as arguments to foo
.
In Scala (def foo(args: T*): Unit
) I may pass a Seq[T]
.
How do I pass the contents of a container (array, vector, iterator, whatever) as arguments to a variadic function in C++? Is it even possible?