How do I get the return type of a lambda that has a deducing this signature using std::invoke_result_t.
auto lambda = [](this auto& self, int x) -> int {
return x;
};
auto x = std::invoke_result_t<decltype(lambda), int>{}; //won't compile
Do I need to somehow specify the self argument inside the std::invoke_result_t ?
I've tried without "deducing this" and the above sample works.
Edit: compiler explorer link
std::invoke_result_t<decltype(lambda), decltype(lambda)&, int>{};and similar. It didn't work for me.std::invoke_result_t<decltype(lambda), decltype(lambda)&, int>{};seems to work; EDIT but maybe because without__cpp_explicit_this_parameterthisparameter. It works without the reference markerthismust be passed either by value (pointer copy) or as a forwarding reference. See devblogs.microsoft.com/cppblog/cpp23-deducing-this. Both work fine