Skip to content
Snippets Groups Projects
Commit f77ab15c authored by vjpai's avatar vjpai
Browse files

Use rvalue ref return to avoid copy

parent c7eed74d
No related branches found
No related tags found
No related merge requests found
...@@ -100,14 +100,14 @@ void PrintAdvancedSignature(Printer *printer, ...@@ -100,14 +100,14 @@ void PrintAdvancedSignature(Printer *printer,
PrintMethodSignature(printer, method, vars); PrintMethodSignature(printer, method, vars);
} }
inline map<string, string> GetMethodVars(const MethodDescriptor *method) { inline map<string, string>&& GetMethodVars(const MethodDescriptor *method) {
map<string,string> res; map<string,string> res;
res["method_name"] = method->name(); res["method_name"] = method->name();
res["request_type"] = method->input_type()->name(); res["request_type"] = method->input_type()->name();
res["response_type"] = method->output_type()->name(); res["response_type"] = method->output_type()->name();
res["request_class"] = ClassName(method->input_type()); res["request_class"] = ClassName(method->input_type());
res["response_class"] = ClassName(method->output_type()); res["response_class"] = ClassName(method->output_type());
return res; return std::forward<map<string,string>>(res);
} }
void PrintMethodDeclarations(Printer *printer, void PrintMethodDeclarations(Printer *printer,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment