
13 Jan
2010
13 Jan
'10
3:50 a.m.
noman javed wrote:
Hi
I want to write a function like that
template
execute(const A& a, T0& arg0, T1& arg&, .. , Tn& argn) { boost::fusion::vector vec(arg0, arg1, .., argn); /* rest of the code */ } Can anybody guide me how can I write this function without overloading it with different number of args?
Write a function that takes one single argument - the vector. Then use appropriate adapters to transform it. See the documentation of the Functional module of Fusion for details. Note that this way does not require your compiler to support variadic template functions - using those is another option. Regards, Tobias