Merge pull request #2939 from vjpai/emplace
Use emplace_back properly, considering limitations of gcc 4.4
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 90f3854..a70b555 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -240,8 +240,7 @@
method->name());
return false;
}
- SyncRequest request(method, tag);
- sync_methods_->emplace_back(request);
+ sync_methods_->emplace_back(method, tag);
}
return true;
}
@@ -286,7 +285,10 @@
if (!has_generic_service_) {
unknown_method_.reset(new RpcServiceMethod(
"unknown", RpcMethod::BIDI_STREAMING, new UnknownMethodHandler));
- sync_methods_->emplace_back(unknown_method_.get(), nullptr);
+ // Use of emplace_back with just constructor arguments is not accepted here
+ // by gcc-4.4 because it can't match the anonymous nullptr with a proper
+ // constructor implicitly. Construct the object and use push_back.
+ sync_methods_->push_back(SyncRequest(unknown_method_.get(), nullptr));
}
// Start processing rpcs.
if (!sync_methods_->empty()) {