Boost logo

Boost :

Subject: Re: [boost] Discovering C++11 lambda argument and result types to construct boost::function
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-02-12 11:15:26

On 02/09/2012 11:20 PM, Frank Birbacher wrote:
> 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?"
> 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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at