|
Boost Users : |
Subject: Re: [Boost-users] [Fusion] Building parameter list for fusion::invoke
From: Nat Linden (nat_at_[hidden])
Date: 2011-01-23 21:56:55
On Sun, Jan 23, 2011 at 2:40 AM, TONGARI <tongari95_at_[hidden]> wrote:
Use Fusion's MPL sequences adapters, so you can have:
>
> typedef typename
> mpl::transform
> <
> parameter_types
> , from_data_source<mpl::_1>
>
> , mpl::back_inserter<mpl::vector<> >
> >::type
> data_source_provider; // a MPL sequence
>
> And invoke as:
>
> fs::invoke(f, data_source_provider());
>
> where from_data_source<T> is defined as:
>
> template<class T>
> struct from_data_source
> {
> operator T() const
>
> {
> return data_source<T>().pop();
> }
> };
>
> Maybe your data_source<T>() is some singleton for the data source?
>
Hmm! That seems more succinct than the explicit recursion in the
interpreter.hpp example.
Apologies if this is a silly question, but suppose the object from which I'd
like to obtain parameter values is locally constructed rather than global?
How would I parameterize the mpl::transform expression above to pass in that
object?
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