Boost logo

Boost :

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


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.

...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

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