Re: Lambdas and result_type
On 4 Nov., 15:36, Pavel Minaev <int...@gmail.com> wrote:
Reading through N2550 (the most recent lambda wording), it seems that
function objects produced from lambda expressions do not have
"result_type" typedef in them, nor any other conventional means to
retrieve the return value of the call-operator.
So far we have in the <concepts> header:
auto concept Callable<typename F, typename... Args> {
typename result_type;
result_type operator()(F&&, Args...);
}
as well as a type-trait version in the <functional> header
template<class> class result_of;
template<class F, class... Args> class result_of<F(Args...)> {
typedef ??? type; // return type, ??? = implementation defined
};
Both are part of the current draft (N2798) and should cover lambdas as
well.
The name "return_type" is just a library-level convention and has no
special meaning as far as the language's core is concerned. So, this
might be one of the reasons why lambdas don't have such a typedef.
Cheers,
SG
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]