Boost logo

Boost :

Subject: Re: [boost] [proto] small breaking change
From: Eric Niebler (eric_at_[hidden])
Date: 2010-06-11 04:38:35


On 6/11/2010 1:57 AM, Joel Falcou wrote:
> Eric Niebler wrote:
>> Just curious, what does your custom generator do?
>
> Given a proto expression X, it builds a
> table_expr< typename proto::tag_of<X>::type, X>
>
> basically I add the tag of the expression in the expression wrapper
> type. Sounds silly but later, we need to know if a given expression
> is of tag A or B and doing so cut a lot of compile time compared to
> calling tag_of each time.

You could access the nested proto_tag typedef directly instead of going
through tag_of (e.g. typename X::proto_tag). Compile-time matters to me
too, which is why I have (so far) avoided allowing arbitrary types
declare themselves Proto expressions. Once you do that, you start
forcing the extensive use of these trait metafunctions, and I worry
about what it might do to compile times.

> It also allow us to overload table_expr
> behavior based on tag without relying on the internal type of proto
> expression, making it easy for developper to add such special behavior
> on some non-trivial expression node.

OK. Interesting, thanks.

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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk