|
Boost Users : |
Subject: Re: [Boost-users] mpl/fusion: metafunction to 'rangify'
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-12-22 18:43:12
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Christopher Schmidt
> Sent: 22 December 2009 23:24
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] mpl/fusion: metafunction to 'rangify'
>
> > In the meantime, can I just use the fusion::transform on the adapted
> struct
> > instead of mpl::transform?
> > What I really want is a new fusion sequence the elements of which are
> the
> > result of my metafunction applied on the elements of the adapted
> struct. So
> > this seemed to be a mpl::transform job.
>
> This should work fine:
>
> struct make_fixed_or_range
> {
> template<typename Sig>
> struct result;
>
> template<typename Self,typename Arg>
> struct result<Self(Arg)>
> {
> typedef fixed_or_range<Arg> type;
> };
>
> template<class Arg>
> typename result<make_fixed_or_range(Arg)>::type
> operator()(Arg);
> };
>
> typedef
> boost::fusion::result_of::as_vector<boost::fusion::result_of::transform<
> params,make_fixed_or_range>::type>::type
> params_fixed_or_range;
>
> -Christopher
It does.
Of course, the return type of fusion::transform contains the compile-time
information required.
Thanks very much,
Now I'll look at spirit (and some magic code to generate the Qi parser for
this new sequence) to fill it up with values from an input stream.
Thanks again,
Rds,
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