
John Maddock wrote:
From within the body of the BOOST_PARAMETER_FUNCTION generated function it appears that I can use the name "Args" to refer to the type of the argument pack, and maybe in the return type as well? But this isn't documented, so can I rely on it?
Apparently not, some more experimentation suggests that "Args" can't be easily used to compute the return type; if I use: typename compute_result<Args>::type as the return type of the function in BOOST_PARAMETER_FUNCTION, then everything is OK, provided I don't try and actually extract anything from the type Args inside compute_result, but if I define it as: template <class Args> struct compute_result { typedef typename boost::parameter::value_type< Args, tag::domain_error, throw_on_error_type> ::type type; }; Then I get endless compiler errors starting with: c:\data\boost\release\boost\boost\parameter\value_type.hpp(62) : error C2661: 'boost::mpl::assert_not_arg' : no overloaded function takes 2 arguments c:\data\boost\boost\sandbox\math_toolkit\libs\math\ide\scrap.cpp(83) : see reference to class template instantiation 'boost::parameter::value_type<Parameters,Keyword,Default>' being compiled with [ Parameters=boost::mpl::pair<boost::parameter::aux::empty_arg_list,boost::parameter::void_>, Keyword=tag::domain_error, Default=throw_on_error_type ] c:\data\boost\boost\sandbox\math_toolkit\libs\math\ide\scrap.cpp(101) : see reference to class template instantiation 'compute_result<Args>' being compiled with [ Args=boost::mpl::pair<boost::parameter::aux::empty_arg_list,boost::parameter::void_> ] c:\data\boost\boost\sandbox\math_toolkit\libs\math\ide\scrap.cpp(101) : see reference to class template instantiation 'boost_param_result_101policy<Args>' being compiled with [ Args=boost::mpl::pair<boost::parameter::aux::empty_arg_list,boost::parameter::void_> ] c:\data\boost\release\boost\boost\parameter\value_type.hpp(62) : error C2866: 'boost::parameter::value_type<Parameters,Keyword,Default>::mpl_assertion_in_line_67' : a const static data member of a managed type must be initialized at the point of declaration with [ Parameters=boost::mpl::pair<boost::parameter::aux::empty_arg_list,boost::parameter::void_>, Keyword=tag::domain_error, Default=throw_on_error_type ] c:\data\boost\boost\sandbox\math_toolkit\libs\math\ide\scrap.cpp(101) : error C2146: syntax error : missing ';' before identifier 'type' c:\data\boost\boost\sandbox\math_toolkit\libs\math\ide\scrap.cpp(101) : error C3254: 'boost_param_result_101policy<Args>' : class contains explicit override 'type' but does not derive from an interface that contains the function declaration with [ Args=boost::mpl::pair<boost::parameter::aux::empty_arg_list,boost::parameter::void_> ] c:\data\boost\boost\sandbox\math_toolkit\libs\math\ide\scrap.cpp(101) : error C2838: 'type' : illegal qualified name in member declaration c:\data\boost\boost\sandbox\math_toolkit\libs\math\ide\scrap.cpp(101) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int Obviously it's not easy to figure out what's going on here, given that this happens inside a macro expansion :-( Thanks for any insight, John.