
On Tue, Feb 8, 2011 at 8:50 PM, Dave Abrahams <dave@boostpro.com> wrote:
On Tue, Feb 8, 2011 at 8:38 PM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
Is there a way to determine at compile-time the number of parameters with default values from a function type?
Nope, it's not part of the type.
OK, not possible. Thanks all for the quick replies. I'm confused because the following code doesn't compile on MSVC but it _does_ compiles fine on GCC... #include <boost/function_types/parameter_types.hpp> #include <boost/mpl/at.hpp> int main() { typedef void (func_type)(double num = -1.23); // NO STANDARD?? typedef boost::function_types::parameter_types<func_type>::type param_types; typedef boost::mpl::at_c<param_types, 0>::type arg_type0; return 0; } 1) Is this a bug in GCC which should not accept `= -1.23` in `func_type`? 2) Both, GCC and MSVC accept the parameter name `num` as part of the `func_type` type. Can parameter names be specified in function types? What does the C++ standard say? Thanks a lot! -- Lorenzo