handle both pattern : function<void ()> and function<void *()>