
Before I go writing a bunch of code... Is there a way to apply the parameters of an ArgumentPack individually to a function? What I need/want is to be able, through Boost.MPL, to apply each argument in the ArgumentPack to a single function based of the keyword type. For example: struct A { template <typename Keyword, typename Value> void SetArgument( Value & v ); }; template <typename ArgPack> void setter( A & a, ArgPack & p ) { // for each arg in p: // a.SetArgument<arg::key_type>(arg.value) } Or equivalent thereof, without knowing ahead of time what the possible argument keywords and values are. I did some minor looking in the parameter code but didn't see anything obvious that already does this. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Rene Rivera <grafik.list@redshift-software.com> writes:
Before I go writing a bunch of code... Is there a way to apply the parameters of an ArgumentPack individually to a function?
What I need/want is to be able, through Boost.MPL, to apply each argument in the ArgumentPack to a single function based of the keyword type. For example:
struct A { template <typename Keyword, typename Value> void SetArgument( Value & v ); };
template <typename ArgPack> void setter( A & a, ArgPack & p ) { // for each arg in p: // a.SetArgument<arg::key_type>(arg.value) }
Or equivalent thereof, without knowing ahead of time what the possible argument keywords and values are. I did some minor looking in the parameter code but didn't see anything obvious that already does this.
It sounds to me like you want a parameter::for_each that can iterate the ArgumentPack. Is that accurate? -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams wrote:
Rene Rivera <grafik.list@redshift-software.com> writes:
Before I go writing a bunch of code... Is there a way to apply the parameters of an ArgumentPack individually to a function?
What I need/want is to be able, through Boost.MPL, to apply each argument in the ArgumentPack to a single function based of the keyword type. For example:
struct A { template <typename Keyword, typename Value> void SetArgument( Value & v ); };
template <typename ArgPack> void setter( A & a, ArgPack & p ) { // for each arg in p: // a.SetArgument<arg::key_type>(arg.value) }
Or equivalent thereof, without knowing ahead of time what the possible argument keywords and values are. I did some minor looking in the parameter code but didn't see anything obvious that already does this.
It sounds to me like you want a parameter::for_each that can iterate the ArgumentPack. Is that accurate?
Yes! Exactly. ...I can write one, if such a thing doesn't exist. Although I've been looking and it seems one would have to do some template type deductions as there's no existing tail type define in the arg_list template. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Rene Rivera wrote:
David Abrahams wrote:
Rene Rivera <grafik.list@redshift-software.com> writes:
Before I go writing a bunch of code... Is there a way to apply the parameters of an ArgumentPack individually to a function?
What I need/want is to be able, through Boost.MPL, to apply each argument in the ArgumentPack to a single function based of the keyword type. For example:
struct A { template <typename Keyword, typename Value> void SetArgument( Value & v ); };
template <typename ArgPack> void setter( A & a, ArgPack & p ) { // for each arg in p: // a.SetArgument<arg::key_type>(arg.value) }
Or equivalent thereof, without knowing ahead of time what the possible argument keywords and values are. I did some minor looking in the parameter code but didn't see anything obvious that already does this. It sounds to me like you want a parameter::for_each that can iterate the ArgumentPack. Is that accurate?
Yes! Exactly.
PS. Of course if an ArgumentPack also modeled an MPL Forward Sequence it would be peachy ;-) Perhaps an adapter that provides such a model from the arg_list? -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Rene Rivera <grafik.list@redshift-software.com> writes:
PS. Of course if an ArgumentPack also modeled an MPL Forward Sequence it would be peachy ;-) Perhaps an adapter that provides such a model from the arg_list?
It wouldn't be enough to model an MPL sequence if you want to get at the actual values of the arguments :) It should model a fusion sequence, but IIRC fusion isn't in the main CVS yet. -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams wrote:
Rene Rivera <grafik.list@redshift-software.com> writes:
PS. Of course if an ArgumentPack also modeled an MPL Forward Sequence it would be peachy ;-) Perhaps an adapter that provides such a model from the arg_list?
It wouldn't be enough to model an MPL sequence if you want to get at the actual values of the arguments :)
But I could get the value with the key assuming I bind the ArgumentPack var into a lambda that gets the value and pass that to an mpl::for_each. Right?
It should model a fusion sequence, but IIRC fusion isn't in the main CVS yet.
Well given that I would prefer making it work with 1.33.1 even having the fusion sequence wouldn't help here :-( -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Rene Rivera wrote:
David Abrahams wrote:
Rene Rivera <grafik.list@redshift-software.com> writes:
PS. Of course if an ArgumentPack also modeled an MPL Forward Sequence it would be peachy ;-) Perhaps an adapter that provides such a model from the arg_list?
It wouldn't be enough to model an MPL sequence if you want to get at the actual values of the arguments :)
But I could get the value with the key assuming I bind the ArgumentPack var into a lambda that gets the value and pass that to an mpl::for_each. Right?
It should model a fusion sequence, but IIRC fusion isn't in the main CVS yet.
Well given that I would prefer making it work with 1.33.1 even having the fusion sequence wouldn't help here :-(
Fusion1 has been part of Spirit since 1.31.0. It's quite stable and has been there for quite some time now. Fusion2 is in the review queue. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

Joel de Guzman <joel@boost-consulting.com> writes:
Rene Rivera wrote:
David Abrahams wrote:
Rene Rivera <grafik.list@redshift-software.com> writes:
PS. Of course if an ArgumentPack also modeled an MPL Forward Sequence it would be peachy ;-) Perhaps an adapter that provides such a model from the arg_list?
It wouldn't be enough to model an MPL sequence if you want to get at the actual values of the arguments :)
But I could get the value with the key assuming I bind the ArgumentPack var into a lambda that gets the value and pass that to an mpl::for_each. Right?
It should model a fusion sequence, but IIRC fusion isn't in the main CVS yet.
Well given that I would prefer making it work with 1.33.1 even having the fusion sequence wouldn't help here :-(
Fusion1 has been part of Spirit since 1.31.0. It's quite stable and has been there for quite some time now. Fusion2 is in the review queue.
Would you like to help us make the ArgumentPack a fusion sequence? -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams wrote:
Joel de Guzman <joel@boost-consulting.com> writes:
Fusion1 has been part of Spirit since 1.31.0. It's quite stable and has been there for quite some time now. Fusion2 is in the review queue.
Would you like to help us make the ArgumentPack a fusion sequence?
Sure. For Fusion1, it would be intrusive, unfortunately. For Fusion2, that should be a breeze. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

Joel de Guzman <joel@boost-consulting.com> writes:
David Abrahams wrote:
Joel de Guzman <joel@boost-consulting.com> writes:
Fusion1 has been part of Spirit since 1.31.0. It's quite stable and has been there for quite some time now. Fusion2 is in the review queue.
Would you like to help us make the ArgumentPack a fusion sequence?
Sure. For Fusion1, it would be intrusive, unfortunately. For Fusion2, that should be a breeze.
I think we'll wait for fusion2, then. I'll make it an MPL sequence in the meantime. Cheers, -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams <dave@boost-consulting.com> writes:
Joel de Guzman <joel@boost-consulting.com> writes:
David Abrahams wrote:
Joel de Guzman <joel@boost-consulting.com> writes:
Fusion1 has been part of Spirit since 1.31.0. It's quite stable and has been there for quite some time now. Fusion2 is in the review queue.
Would you like to help us make the ArgumentPack a fusion sequence?
Sure. For Fusion1, it would be intrusive, unfortunately. For Fusion2, that should be a breeze.
I think we'll wait for fusion2, then. I'll make it an MPL sequence in the meantime.
This is now done. Enjoy! -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams wrote:
David Abrahams <dave@boost-consulting.com> writes:
I think we'll wait for fusion2, then. I'll make it an MPL sequence in the meantime.
This is now done. Enjoy!
OK... I would like to enjoy it :-) But where are the changes? (Haven't seen any CVS activity in the parameter files.) -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Rene Rivera <grafik.list@redshift-software.com> writes:
David Abrahams wrote:
David Abrahams <dave@boost-consulting.com> writes:
I think we'll wait for fusion2, then. I'll make it an MPL sequence in the meantime.
This is now done. Enjoy!
OK... I would like to enjoy it :-) But where are the changes? (Haven't seen any CVS activity in the parameter files.)
I discovered 10 minutes ago that it had been put on a branch. Check the trunk now. -- Dave Abrahams Boost Consulting www.boost-consulting.com

Rene Rivera <grafik.list@redshift-software.com> writes:
David Abrahams wrote:
Rene Rivera <grafik.list@redshift-software.com> writes:
PS. Of course if an ArgumentPack also modeled an MPL Forward Sequence it would be peachy ;-) Perhaps an adapter that provides such a model from the arg_list?
It wouldn't be enough to model an MPL sequence if you want to get at the actual values of the arguments :)
But I could get the value with the key assuming I bind the ArgumentPack var into a lambda that gets the value and pass that to an mpl::for_each. Right?
Cute. Yes, you could.
It should model a fusion sequence, but IIRC fusion isn't in the main CVS yet.
Well given that I would prefer making it work with 1.33.1 even having the fusion sequence wouldn't help here :-(
Okay, I think the MPL sequence business is a great idea. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
David Abrahams
-
Joel de Guzman
-
Rene Rivera