Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-04-05 11:02:30


on Thu Apr 05 2007, Michael Lacher <michael.lacher-AT-hlw.co.at> wrote:

> David Abrahams wrote:
>> on Mon Apr 02 2007, "Eric Lemings" <lemings-AT-roguewave.com> wrote:
>>
>>> Expression templates sound very interesting. Could you give a quick
>>> summary or a link perhaps?
>>
>> This is the canonical source:
>>
>> http://osl.iu.edu/~tveldhui/papers/Expression-Templates/exprtmpl.html
>>
>
> Hmm, isnt that just boost::lambda?

Umm, no. Boost.Lambda is just _that_ :)
Todd's work is the original and everything else followed.

> I haven't used boost::lambda much
> yet, and i am not really proficient in functional programmign either,
> but could not the example form the page above:
>
> int main()
> {
> DExpr<DExprIdentity> x; // Placeholder
> evaluate(x/(1.0+x), 0.0, 10.0);
> return 0;
> }
>
> be written in boost:lambda as follows ?
>
> int main()
> {
> evaluate(_1/(1.0+_1), 0.0, 10.0);
> return 0;
> }
>
> If yes, what exactly can expression templates do that boost lambda cannot ?

Anything you like :) Read the section on optimizing vector
expressions, for example. Then see http://www.oonumerics.org/blitz/

Boost.Lambda is just one example of the use of expression templates:
in a library for generating anonymous function objects. Boost.Spirit
is an example of the use of expression templates in a library for
generating parsers. Boost.Xpressive is an example of the use of
expression templates in a library for building regular expression
matchers.

Boost.Proto is a library that abstracts out a great deal of the hard
work the authors of those other libraries have to do. It is a library
for building libraries that rely on expression templates.

HTH,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com
Don't Miss BoostCon 2007! ==> http://www.boostcon.com

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