Skip to content
Snippets Groups Projects
Commit 99076fe5 authored by Nicolas "Pixel" Noble's avatar Nicolas "Pixel" Noble
Browse files

Fixing generated code under Windows.

By the standard, std::function can only capture class functions, and not
class methods. For some reasons, this works under gcc however. Visual
Studio rejects it. std::mem_fn is proper template to use.
parent df3c6c55
Branches
Tags
No related merge requests found
...@@ -828,9 +828,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, ...@@ -828,9 +828,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer,
" new ::grpc::RpcMethodHandler< $ns$$Service$::Service, " " new ::grpc::RpcMethodHandler< $ns$$Service$::Service, "
"$Request$, " "$Request$, "
"$Response$>(\n" "$Response$>(\n"
" std::function< ::grpc::Status($ns$$Service$::Service*, " " std::mem_fn(&$ns$$Service$::Service::$Method$), this),\n"
"::grpc::ServerContext*, const $Request$*, $Response$*)>("
"&$ns$$Service$::Service::$Method$), this),\n"
" new $Request$, new $Response$));\n"); " new $Request$, new $Response$));\n");
} else if (ClientOnlyStreaming(method)) { } else if (ClientOnlyStreaming(method)) {
printer->Print( printer->Print(
...@@ -840,10 +838,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, ...@@ -840,10 +838,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer,
" ::grpc::RpcMethod::CLIENT_STREAMING,\n" " ::grpc::RpcMethod::CLIENT_STREAMING,\n"
" new ::grpc::ClientStreamingHandler< " " new ::grpc::ClientStreamingHandler< "
"$ns$$Service$::Service, $Request$, $Response$>(\n" "$ns$$Service$::Service, $Request$, $Response$>(\n"
" std::function< ::grpc::Status($ns$$Service$::Service*, " " std::mem_fn(&$ns$$Service$::Service::$Method$), this),\n"
"::grpc::ServerContext*, "
"::grpc::ServerReader< $Request$>*, $Response$*)>("
"&$ns$$Service$::Service::$Method$), this),\n"
" new $Request$, new $Response$));\n"); " new $Request$, new $Response$));\n");
} else if (ServerOnlyStreaming(method)) { } else if (ServerOnlyStreaming(method)) {
printer->Print( printer->Print(
...@@ -853,10 +848,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, ...@@ -853,10 +848,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer,
" ::grpc::RpcMethod::SERVER_STREAMING,\n" " ::grpc::RpcMethod::SERVER_STREAMING,\n"
" new ::grpc::ServerStreamingHandler< " " new ::grpc::ServerStreamingHandler< "
"$ns$$Service$::Service, $Request$, $Response$>(\n" "$ns$$Service$::Service, $Request$, $Response$>(\n"
" std::function< ::grpc::Status($ns$$Service$::Service*, " " std::mem_fn(&$ns$$Service$::Service::$Method$), this),\n"
"::grpc::ServerContext*, "
"const $Request$*, ::grpc::ServerWriter< $Response$>*)>("
"&$ns$$Service$::Service::$Method$), this),\n"
" new $Request$, new $Response$));\n"); " new $Request$, new $Response$));\n");
} else if (BidiStreaming(method)) { } else if (BidiStreaming(method)) {
printer->Print( printer->Print(
...@@ -866,10 +858,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer, ...@@ -866,10 +858,7 @@ void PrintSourceService(grpc::protobuf::io::Printer *printer,
" ::grpc::RpcMethod::BIDI_STREAMING,\n" " ::grpc::RpcMethod::BIDI_STREAMING,\n"
" new ::grpc::BidiStreamingHandler< " " new ::grpc::BidiStreamingHandler< "
"$ns$$Service$::Service, $Request$, $Response$>(\n" "$ns$$Service$::Service, $Request$, $Response$>(\n"
" std::function< ::grpc::Status($ns$$Service$::Service*, " " std::mem_fn(&$ns$$Service$::Service::$Method$), this),\n"
"::grpc::ServerContext*, "
"::grpc::ServerReaderWriter< $Response$, $Request$>*)>("
"&$ns$$Service$::Service::$Method$), this),\n"
" new $Request$, new $Response$));\n"); " new $Request$, new $Response$));\n");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment