Boost logo

Proto :

Subject: Re: [proto] Expression as *other* fusion sequence
From: Eric Niebler (eric_at_[hidden])
Date: 2011-06-20 16:45:57


On 6/17/2011 6:46 PM, Joel falcou wrote:
> On 17/06/11 01:25, Eric Niebler wrote:
>> Doable, but not easy. The problem you'll have is that all Proto
>> expression types have a nested fusion_tag that is a typedef for
>> proto::tag::proto_expr. That is how Fusion figures out how to iterate
>> over Proto expressions. You'll need to define your own tag, use
>> proto::extends (not BOOST_PROTO_EXTENDS) to define an expression
>> extension, and hide the fusion_tag typedef in the base with your own.
>> Then you'll need to implement the necessary Fusion hooks for your custom
>> Fusion tag type.
>
> OK, but is there any internal proto part relying on the proper fusion
> behavior that may get hampered by this ?

No. There are few places where Proto's core makes use of the Fusion
interface of Proto expression. proto::fold is one, but it detects when
it's operating on a Proto expression and skips Fusion to iterate over
the children directly (for better compile times).

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com