Boost Users :
Subject: Re: [Boost-users] mpl/fusion: metafunction to 'rangify'
From: Christopher Schmidt (mr.chr.schmidt_at_[hidden])
Date: 2009-12-22 18:23:35
Hicham Mouline schrieb:
>> Hicham Mouline schrieb:
>>> I am making small progress in my attempt to generate a new mpl
>>> that I will use to read from a stream.
>>> The following code fails to compile:
>> You should work with a copy of fusion's trunk. See
>> for more information.
> Exactly what I just discovered. I copied the fix in
> The is_sequence works but as you say below, mpl::transform doesn't.
>> Unfortunately there is another problem. mpl::transform internally
>> instantiates mpl::clear. Fusion's implementation of mpl::clear only
>> works for the built-in container. I think fusion's mpl::clear should
>> rather forward to fusion::clear and fusion::clear should return a
>> simple, empty container that models the same category as the sequence to
>> be cleared. At the moment, fusion::clear returns fusion::vector0<> in
>> any case.
> Stjepan Rajko had a similar problem back in Feb09 and seems to have solved
> it, but I don't understand.
> He adds a bit of code in (see pastebin)
This code provides a specialization of fusion's mpl::clear for adapted
arrays. This makes his particular use-case compile fine but this does
not solve the general problem.
> 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:
template<typename Self,typename Arg>
typedef fixed_or_range<Arg> type;
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