
Matt Calabrese wrote:
On 10/10/05, Jeff Garland <jeff@crystalclearsoftware.com> wrote:
Expression rearrangement is really cool stuff
<snip>
Right now I plan on adding function templates which act as expression modifiers that turn on and off reordering i.e. strictly_ordered( expression_here ) to make it such that the internal expression isn't reordered, and loosely_ordered( expression_here ) to explicitly allow the internal expression to be reordered (which can be nested inside strictly_ordered expression). Similar toggles would be made for other optimizations through expression templates.
<snip> This set off a bell in my head. I had to do similar expression template manipulation in xpressive, and I wrote an expression template parser to help. It currently lives in boost/xpressive/proto. It is essentially a generic expression template framework and a handlful of generally useful "compilers" that plug into the framework to transform the expression template into a target form. For instance, there is a transform_compiler that finds a pattern in your expression template and transforms it according to a MPL-style lambda that you provide. There is no documentation for it yet, but if you think it might be useful, you may want to have a look at how xpressive uses it to transform an expression template into a regex. That code lives at boost/xpressive/detail/static/productions. If you decide to go this route, I'd could lend a hand. IMO, Boost could use a library for ET manipulation, and proto is a start. Yours sounds like a good application. -- Eric Niebler Boost Consulting www.boost-consulting.com