cpp_generator::print_method_header: extract out variant taking name and arity