Constructor with variable number of arguments

Dear ROOTers,

my new class has a constructor with a variable number of arguments.

In principle it works with ACLIC. However, if I give the parameter before the “…” in the function definition a default value, the dictionary generator seems to get confused (both via ACLIC and if rootcint is called by hand).

Please try the attached example with ACLIC, once with the non-default constructor being

ttest(char* FormatString, double dummy, double Default_Value_Causes_Trouble_Here, ...)

(=> works) and another time with

ttest(char* FormatString, double dummy, double Default_Value_Causes_Trouble_Here = 0., ...)

(=> “[path]\variadic_constructor_problem_C_ACLiC_dict.cxx(200) : error C2664: ‘ttest::ttest(char *,double,double,…)’ : cannot convert parameter 3 from ‘G__va_arg_buf’ to ‘double’”)

Any ideas how I can get around this?

Thanks,

Moritz

PS: I am using root 5.21/04 with Visual C++ 2008 under Windows Vista.
variadic_constructor_problem.C (800 Bytes)

Hi,

Thanks for reporting this problem. I have uploaded a fix in the trunk on the SVN repository.

[quote]Any ideas how I can get around this?[/quote]Short of downloading today’s trunk, you can work around this problem by not using a default parameter but overloading the constructor with yet another constructor with fewer arguments.

Cheers,
Philippe