
Alexander Nasonov <alnsn <at> yandex.ru> writes:
I'm very impressed how you wrote it off the top of your head :->
I didn't. I've been toying with it for a couple of days.
But it's definitely too much magic. Though, it made me think of another magic: study alloca implementations and replace a global variable with something like
<snip>
Why do you need this magic? BOOST_SCOPE_EXIT( (hello)(world) ) // line 1 /* Expands to: struct args_line1_t { std::string &hello, &world; } args_line1 = { hello, world }; struct scope_exit_line1 { args_line1_t* m_args; ~scope_exit() { doit(p->hello, p->world); } static void doit(std::string& hello, std::string& world) */ { // scope(exit) code } BOOST_SCOPE_EXIT_END // line 5 /* } scope_exit_line5 = { &args_line1 }; */ In Christ, Steven Watanabe