
Edward Diener wrote:
Tobias Schwinger wrote:
Hi Community,
The Function Types library has just been updated to include an implementation of closure functions as an example:
[ example (hpp): http://tinyurl.com/9ncso ] [ exmaple (cpp): http://tinyurl.com/9opx6 ]
You need to have the Function Types library installed if you want to successfully compile it:
[ archive (zip): http://tinyurl.com/4oe7q ] [ documentation: http://tinyurl.com/4fw9n ]
A closure function (in object orientated context) is a member function bound to an object.
Closure functions are well-suited to achieve orthogonal design because they capture member functions independent of their name and class an thus allow to operate on a per-function basis instead of requiring inheritance to e.g. implement classic design patterns such as "Observer".
In contrast to Boost.Bind (and other Boost argument binding facilities) closures are intended to be stored and allow the captured target function to dynamically change at runtime.
Boost.Function stores the results of Boost.Bind, and already serves as a "closure function".
OK, this is far more flexible ==> it stays just an example ;-)... Thanks, Tobias