Boost logo

Boost Users :

Subject: Re: [Boost-users] mpl/fusion: metafunction to 'rangify'
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-12-22 18:05:09


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Christopher Schmidt
> Sent: 22 December 2009 22:50
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] mpl/fusion: metafunction to 'rangify'
>
> Hicham Mouline schrieb:
> > I am making small progress in my attempt to generate a new mpl
> sequence
> > that I will use to read from a stream.
> >
> >
> >
> > The following code fails to compile:
> [snip]
>
> You should work with a copy of fusion's trunk. See
>
> http://thread.gmane.org/gmane.comp.lib.boost.user/53893/
>
> for more information.
Exactly what I just discovered. I copied the fix in
fusion/adapted/struct/adapt_struct.hpp
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.
>
> -Christopher
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)
http://lists.boost.org/boost-users/2009/02/45051.php

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.

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