Use emplace_back properly and when appropriate, considering limitations

of gcc4.4
pull/2939/head
Vijay Pai 9 years ago
parent 0c3b4c803e
commit 8fe60a87ea
  1. 7
      src/cpp/server/server.cc

@ -240,8 +240,7 @@ bool Server::RegisterService(const grpc::string *host, RpcService* service) {
method->name()); method->name());
return false; return false;
} }
SyncRequest request(method, tag); sync_methods_->emplace_back(method, tag);
sync_methods_->emplace_back(request);
} }
return true; return true;
} }
@ -286,7 +285,9 @@ bool Server::Start() {
if (!has_generic_service_) { if (!has_generic_service_) {
unknown_method_.reset(new RpcServiceMethod( unknown_method_.reset(new RpcServiceMethod(
"unknown", RpcMethod::BIDI_STREAMING, new UnknownMethodHandler)); "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
// by gcc-4.4 because nullptr is an anonymous class, so we're constructing
sync_methods_->push_back(SyncRequest(unknown_method_.get(), nullptr));
} }
// Start processing rpcs. // Start processing rpcs.
if (!sync_methods_->empty()) { if (!sync_methods_->empty()) {

Loading…
Cancel
Save