Passing a lambda is really easy in c++11:
func( []( int arg ) {
// code
} ) ;
But I\'m wondering, what is the cost of passing a
See also C++11 lambda implementation and memory model
A lambda-expression is just that: an expression. Once compiled, it results in a closure object at runtime.
5.1.2 Lambda expressions [expr.prim.lambda]
The evaluation of a lambda-expression results in a prvalue temporary (12.2). This temporary is called the closure object.
The object itself is implementation-defined and may vary from compiler to compiler.
Here is the original implementation of lambdas in clang https://github.com/faisalv/clang-glambda