Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL][FUSION] generate fusion::map from mpl::vector
From: Manuel Jung (gzahl_at_[hidden])
Date: 2008-09-29 03:22:48


Adam Merz wrote:

Hey,

> Manuel Jung <gzahl <at> arcor.de> writes:
>> Well this is what i've got so far:
>>
>> template< typename OutSignatures >
>> class filter_impl{
>> typedef typename mpl::transform< OutSignatures,
>> boost::promise_stream<mpl::_1> >::type OutStreams;
>>
>> typedef typename mpl::transform< OutSignatures, OutStreams,
>> fusion::make_pair< mpl::_1, mpl::_2 > >::type OutPairs;
>>
>> typedef typename fusion::result_of::as_map< fusion::vector<
>> OutPairs >
>> >::type Out_type;
>>
>> }
>>
>> This compiles fine. But i'm not able to generate some fusion::map from
>> the Out_type.
>> I get compiling errors than.
>
> Upon looking at your original code further, there does indeed appear to be
> a trivial fix to get it to compile -- add result_of:: before make_pair,
> and get rid of fusion::vector<> around OutPairs:
>
>
> template<typename OutSignatures>
> struct filter_impl
> {
> typedef typename mpl::transform
> <
> OutSignatures,
> boost::promise_stream<mpl::_1>
> >::type OutStreams;
>
> typedef typename mpl::transform
> <
> OutSignatures,
> OutStreams,
> fusion::result_of::make_pair<mpl::_1, mpl::_2>
> >::type OutPairs;
>
> typedef typename fusion::result_of::as_map<OutPairs>::type OutMap;
> };
>
>
> This can now be reduced to the more succinct:
>
>
> template<typename OutSignatures>
> struct filter_impl
> {
> typedef typename fusion::result_of::as_map
> <
> typename mpl::transform
> <
> OutSignatures,
> fusion::result_of::make_pair
> <
> mpl::_1,
> boost::promise_stream<mpl::_1>
> >
> >::type
> >::type OutMap;
> };

Well this looks nice, but it doesn't compile for me.
I attached the compile errors output.
Thanks!




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