Variadic template function?

Michiel nomail at hotmail.com
Thu Feb 8 02:04:23 PST 2007


I need a function like this (I simplified the actual function):

void foo(T)(T[] elements ...) { /* code */ }

And while it compiles fine by itself, I can't (for example) use it like this:

foo(1, 2, 3, 4, 5);

I get the following compiler messages:

main.d(27): template tools.Set.set(T) does not match any template declaration
main.d(27): template tools.Set.set(T) cannot deduce template function from
argument types (int,int,int,int,int)

That's a shame. Any idea how I can make this work? I want to use it to create
a sort of set literal for my set implementation.

Thanks!



More information about the Digitalmars-d mailing list