|
Boost Users : |
Subject: Re: [Boost-users] How to forward to a list of boost::function?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-03-16 02:00:08
On Mon, Mar 15, 2010 at 9:59 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> John Ky wrote:
>>
>> I have a class:
>>
>> template<typename function_type>
>> class function_vector {
>> private:
>> Â std::vector<boost::function<function_type> > functions;
>> };
>>
>>
>> I want to write an operator() for this template class that takes all the
>> arguments necessary to invoke a function of type function_type. Â When
>> called, it should call each function in the functions field.
>>
>> How do I do this?
>>
>> I think Boost.Signals2 does something like this, but I can't work out how
>> it
>> is done.
>>
>
> Signals does it by specializing for every possible arity.
Although you (nor signals) needed to do it that way. Using
Boost.Fusion you can have it be all automatic, probably even simplify
it more if you need better forwarding with
Boost.Functional.Forwarding.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net