Boost logo

Boost :

Subject: Re: [boost] [Proto] Expression as fusion/MPL sequence
From: Eric Niebler (eric_at_[hidden])
Date: 2011-06-01 23:24:39

On 6/2/2011 7:02 AM, Joel Falcou wrote:
> Seems somethign crooky on this front. Calling fusion::at_c on expression
> ends up in error even after including boost/proto/fusion.hpp.
> Same way, flatten used as a transform seems to not give me a type that
> can be passed to any fusion or mpl function. Looking at
> proto/fusion.hpp I noticed that the iterator is indeed random_access but
> not the view itself which as a forward_traversal tag. Even
> after fixing this, no dice, at_c<N>(some_proto_expr) still fails to
> compile.

That's odd. Proto's fusion tests are passing on trunk and release, and
the following program compiles for me (on trunk):

  #include <boost/proto/proto.hpp>
  #include <boost/fusion/include/at_c.hpp>

  namespace proto = boost::proto;
  namespace fusion = boost::fusion;

  int main()
    proto::terminal<int>::type i = {42};
    fusion::at_c<1>(i + i);

Can you post some code that demonstrates the problem?

Proto expressions are random access, but flattened views are
forward-only. That's a limitation of the current implementation of the
segmented Fusion stuff. It's a known problem. Segmented fusion needs a
complete rewrite, but it's a metaprogramming Everest, and I'm too tired
to climb it again. Some hot-shot metaprogramming wunderkind should try
cutting his/her teeth on that problem. They'd earn my eternal admiration
and appreciation.

Eric Niebler
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at