make_argpack(vec_kwd, make_vector(arg[0], ..., arg[n-1]))
Hi All, Any suggestion for this? typedef typename mpl::transform<range_c<0,n>,meta::kwd >::type vec_kwd_t; arg_list< tagged_argument<tag<0>,A<0> >, ... arg_list< tagged_argument<tag<n-1>,A<n-1> >, empty_arg_list >
make_argpack(vec_kwd,make_vector(arg[0],...,arg[n-1])){ // Step 1: get a vector of tagged_argument vec_tagged_arg_t vec_tagged_arg = fusion::transform( kwds, args, binary_f() ); //OK // Step 2: // recursively construct args_list_t from vec_tagged_arg using // arg_list(TaggedArg arg, Next const& tail) // : Next(tail) // // , arg(arg) // // {} // // A little tedious. Before I go ahead : is this the proper way? // A better solution altogether? } Thanks.
AMDG er wrote:
Any suggestion for this?
I'm afraid I don't understand what you are trying to do. Can you explain in English rather than posting code that doesn't work?
<snip code>
In Christ, Steven Watanabe
Can you explain in English rather than posting code
Sorry, I was confused. I think I wanted to simplify fun( ( kwd<1>::value = arg1, // parameter::keyword<tag<1> >& kwd<1>::value ... kwd<n>::value = argn // parameter::keyword<tag<n> >& kwd<n>::value ) ) and I should have probably looked for something like this typedef parameter::parameters< required<tag<1> >, ..., required<tag<n> >
spec;
fun( spec(arg1,...,argn) ) So now, how to I create spec automatically? template<std::size_t First,std::size_t Last> struct spec{ //First = 1, Last = n+1 in the example above typedef ... type; };
Upon reflexion, my problem boils down to finding a metafunction that maps an mpl sequence, such as typedef mpl::vector<tag1,...,tagn> input; to the template class boost::parameter::parameters instantiated with the elements of that sequence, each wrapped with required: typedef parameter::parameters< required<tag1>, ... require<tagn>
output;
The implementation of parameter::parameters uses a macro so unless I'm willing to/can generate input with macro it seems like a dead end. Correct?
er wrote:
Upon reflexion, my problem boils down to finding a metafunction that maps an mpl sequence, such as
typedef mpl::vector<tag1,...,tagn> input;
to the template class boost::parameter::parameters instantiated with the elements of that sequence, each wrapped with required:
typedef parameter::parameters< required<tag1>, ... require<tagn>
output;
The implementation of parameter::parameters uses a macro so unless I'm willing to/can generate input with macro it seems like a dead end. Correct?
Does mpl::unpack_args sound like a valid starting point?
participants (2)
-
er
-
Steven Watanabe