
23 Aug
2010
23 Aug
'10
2:05 p.m.
On 23/08/10 13:43, Dmitry Goncharov wrote:
What's wrong with the following? Aside from the know limitations. (local::f cannot be a template arg or be a function template). void f() { struct local { static void f() {} }; local::f(); }
Does your library have advantages over this?
I believe his macro has mechanisms for catching some variables in scope (at least, ScopeExit had). Something you would do with struct local { local(int j_) : j(j_) {} int operator()(int i) { return i + j; } private: int j; }; local f(j); could be written as something like LOCAL_FUNCTION_BEGIN(f, (j), (int i)) { return i + j; } LOCAL_FUNCTION_END Surely you would agree the second form is quite more succint