Is it possible to get the address of the lambda call operator for a lambda having captures ? And even more: to assign such a pointer to a common pointer which can point to different lambdas having the same captures and the same calling-parameters ? Strictly speaking, assigning a result (class1::*)( ... )
to another result (class2::*)( ... )
shouldn't be directly possible, but you might do dirty tricks and cast the pointers which could be possible since the lambda-classes are notionally interchangeable.
So what's the "proper" syntax for this ? Even as a dirty trick.
The last line of the following code unfortunately doesn't work:
int main()
{
int i;
auto l100 = [&]()
{
i += 100;
};
using l100_t = decltype(l100);
using l100_fn = void (l100_t::*)();
l100_fn fn100 = &l100_t::operator ();
}