Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2006-01-25 19:46:40


Rene Rivera wrote:
> David Abrahams wrote:
>> Rene Rivera <grafik.list_at_[hidden]> 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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk