C++ functors and boost bind

diego at trusteagle.com diego at trusteagle.com
Wed Dec 16 02:49:37 PST 2009


I may come from a different background, and also don't know the history and the full extent of the discussion (e.g. http://mail.openjdk.java.net/pipermail/closures-dev/2009-November/000267.html ), but I don't fully understand the syntax. I hope somebody will take my opinion into account still in this late stage.

In C++ there is a nicer and more straight forward syntax for callbacks available with functors, an example is here: 

http://www.boost.org/doc/libs/1_41_0/libs/bind/bind.html#with_boost_function 

and you can also have 

playButton.onClick(param one,param two)

with an implementation of 
void operator()(param one , param two)
in the class button

At that point you do have a full and extensible object interface and you don't need to have extra syntactic sugar.

This same stuff is used for threads, sockets and ui callbacks.

Cheers,
D. 



More information about the closures-dev mailing list