[function_types] About parameter_types

Hi all, I am trying to extract the parameters types of a given function/functor in a mpl sequence. Digging boost libraries, I came across function_types, and in particular parameter_types, which might be the right tool. However, I cannot figure how to use it. Could you please help ? Suppose I have: void foo(int, double); And would like to generate the following sequence: mpl::vector<int, double> How can I do that ? Regards, Olivier

Olivier Tournaire wrote:
Hi all,
I am trying to extract the parameters types of a given function/functor in a mpl sequence. Digging boost libraries, I came across function_types, and in particular parameter_types, which might be the right tool. However, I cannot figure how to use it. Could you please help ? Suppose I have:
void foo(int, double);
And would like to generate the following sequence:
mpl::vector<int, double>
How can I do that ?
You just pass the type of your function to parameters_type. typedef typename parameter_types<BOOST_TYPEOF(foo)>::type params; -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35

2010/1/30 joel falcou <joel.falcou@lri.fr>
Olivier Tournaire wrote:
Hi all,
I am trying to extract the parameters types of a given function/functor in a mpl sequence. Digging boost libraries, I came across function_types, and in particular parameter_types, which might be the right tool. However, I cannot figure how to use it. Could you please help ? Suppose I have:
void foo(int, double);
And would like to generate the following sequence:
mpl::vector<int, double>
How can I do that ?
You just pass the type of your function to parameters_type.
typedef typename parameter_types<BOOST_TYPEOF(foo)>::type params;
Thank you Joel. Perfect, if typename is removed. Regards, Olivier
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
joel falcou
-
Olivier Tournaire