For a good reference on on the STL, see STL Programmer's Guide at SGI
Provides some basic classes and functions to generate STL functionals from lambda-expressions. Variables which are used in the lambda-expressions, must be declared as placeholders of some type:
placeholder<42, int> i; placeholder<666, int> j;
The first template parameter to placeholder is an arbitrary integer which is used to make the type of a placeholder different from that of any other placeholder. Given the above, lambda(i, i*i) is a unary functional which calculates the square of its argument, and lambda(i, j, i+j) is a binary functional. These can be used as in
tranform(v.begin(), v.end(), res.begin(), lambda(i, i*i))
assuming v and res are vectors of the same kind.
A lambda-function is an STL functional, whereas the body part of a lambda-function is a expression, so in order to use a lambda functional inside this expression, the function apply must be used:
transform(v.begin(), v.end(), res.begin(), lambda(i, i + apply(lambda(i, j, i*i + j*j), where(i > 0, i, -i), 2*i))
where is a replacement for `operator?:', as the latter cannot be overloaded, so the above where expression returns the absolute value of i.
Well, this documentation is minimal, -- your best bet is the examples: