Hi I'm trying to count the number of parameters in a function-type: cout << boost::mpl::count< boost::function_types::parameter_types< void() > >::value << endl; cout << boost::mpl::count< boost::function_types::parameter_types< void(int) > >::value << endl; cout << boost::mpl::count< boost::function_types::parameter_types< void(int, int) > >::value << endl; This prints: 0 0 0 I would have expected: 0 1 2 What have I done wrong? -- Allan W. Nielsen
AMDG On 11/23/2011 09:29 AM, Allan Nielsen wrote:
I'm trying to count the number of parameters in a function-type:
cout << boost::mpl::count< boost::function_types::parameter_types< void() > >::value << endl; cout << boost::mpl::count< boost::function_types::parameter_types< void(int) > >::value << endl; cout << boost::mpl::count< boost::function_types::parameter_types< void(int, int) > >::value << endl;
This prints: 0 0 0
I would have expected: 0 1 2
What have I done wrong?
What you want is mpl::size. mpl::count takes two arguments and return the number of elements equal to the second argument (like std::count). In Christ, Steven Watanabe
Ahh.. thanks
On Fri, Nov 25, 2011 at 8:40 AM, Steven Watanabe
AMDG
On 11/23/2011 09:29 AM, Allan Nielsen wrote:
I'm trying to count the number of parameters in a function-type:
cout << boost::mpl::count< boost::function_types::parameter_types< void() > >::value << endl; cout << boost::mpl::count< boost::function_types::parameter_types< void(int) > >::value << endl; cout << boost::mpl::count< boost::function_types::parameter_types< void(int, int) > >::value << endl;
This prints: 0 0 0
I would have expected: 0 1 2
What have I done wrong?
What you want is mpl::size. mpl::count takes two arguments and return the number of elements equal to the second argument (like std::count).
In Christ, Steven Watanabe _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Allan Nielsen
-
Steven Watanabe