#include <iostream>
#include <functional> 
using namespace std;



function<void()>* preparatory_work() {
    auto l = [](){ cout<< "My lambda is fine !" <<endl; } ;  // lambda 
    function<void ()> f = l;                                 // functor
    auto p = new function<void()>(l);                        // a functor on the heap
	
    l();  // inovke the lambda object 
    f();  // invoke the functor 
    (*p)(); // invoke functor via a pointer 

    return p; 
}

int main() {
    auto fcp = preparatory_work();
    (*fcp)();
    void *x = (void*)fcp; 
    (*(function<void()>*)x)(); 
    
}