Is it possible to bring functional programming to C ++ in any way, I want to pass some LAMBDA function or operators as a parameter to another function.
eg:
void test(DWORD foo)
{
try { __asm { call foo; } }
catch (...) { () }
}
or:
void test2(DWORD foo)
{
someconnection.Open();
__asm { call foo; }
someconnection.Close();
}
and use:
int main ()
{
...
dosomething();
...
void operator()(int n)
{
dosomething();
dosomethingelse();
}
test ( *operator(5) )
test2 ( *operator(10) )
...
dosomethingelse();
...
}
I am using Visual Studio 2010 and not sure if I can use C ++ 0x there, but I can use boost if this can do what I want to do.
So, are there any ways to do this?
Masha source
share