Boost logo

Boost :

Subject: Re: [boost] Discovering C++11 lambda argument and result types to construct boost::function
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2012-02-10 03:39:10


> 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...>
> 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.

The task you are attempting to solve looks very unusual to me. All the
usages of a lambda I encountered so far are that you know the type of a
callback in advance and define the lambda so that it matches the signature
of the targeted callback.

Sorry if this question is silly, but could you give me an example of where
this deduction mechanism could be used?

Regards,
&rzej


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk