
On 02/09/2012 11:20 PM, Frank Birbacher wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi!
On comp.lang.c++.moderated I talked to Daniel Krügler about how to discover argument and result types from C++11 lambdas in a template context. The thread has the title "How to discover argument and result types from lambda for constructing std::function?"
https://groups.google.com/d/topic/comp.lang.c++.moderated/qaMECIUlJp0/discus...
The task is to provide a function template "make_function" that takes a C++11 lambda expression and returns a boost::function with the correct signature to call the lambda. This may be extended to accept any other callable type.
Is there such a thing already in Boost? I'd like to add it. Would it go to Boost.Function alone? Or would parts fit into TypeTraits? Does Doug still maintain Boost.Function?
I think you should just do a meta-function that gives the function type that matches a given lambda. No need to put boost::function in the loop at all. Once you have your function type, you can directly use it as an argument to boost::function, std::function, or whatever other compatible template.