#if 1 namespace std { template struct function; template struct function { typedef R function_type (Args...); function_type *func; R operator () (Args...) { return func (); } function &operator = (function_type *func) { this->func = func; return *this; } }; } #else #include #endif struct with_function { std::function cb; void operator () () { cb (); } }; struct with_virtual { struct interface { virtual void cb () = 0; }; interface *iface; void operator () () { iface->cb (); } }; extern with_function wf; extern with_virtual wv;