Basically, I want to know if something like the below is possible? If this isn't possible is there any way to fake it?
#include <iostream>
using namespace std;
template<typename Functor>
void foo(Functor func)
{
auto test = [](Functor f){ int i = 5; f(); };
test(func);
}
int main()
{
foo([](){ cout << i << endl;});
}