| 
					
				 | 
			
			
				@@ -48,10 +48,8 @@ ServerBuilder::ServerBuilder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       sync_server_settings_(SyncServerSettings()), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       resource_quota_(nullptr) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   gpr_once_init(&once_init_plugin_list, do_plugin_list_init); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto it = g_plugin_factory_list->begin(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       it != g_plugin_factory_list->end(); it++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    auto& factory = *it; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    plugins_.emplace_back(factory()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& value : *g_plugin_factory_list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plugins_.emplace_back(value()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // all compression algorithms enabled by default. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -205,14 +203,14 @@ ServerBuilder& ServerBuilder::AddListeningPort( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   grpc::ChannelArguments args; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto option = options_.begin(); option != options_.end(); ++option) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    (*option)->UpdateArguments(&args); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    (*option)->UpdatePlugins(&plugins_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& option : options_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    option->UpdateArguments(&args); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    option->UpdatePlugins(&plugins_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    (*plugin)->UpdateServerBuilder(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    (*plugin)->UpdateChannelArguments(&args); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& plugin : plugins_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plugin->UpdateServerBuilder(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    plugin->UpdateChannelArguments(&args); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (max_receive_message_size_ >= -1) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -243,16 +241,16 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // == Determine if the server has any syncrhonous methods == 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   bool has_sync_methods = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto it = services_.begin(); it != services_.end(); ++it) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if ((*it)->service->has_synchronous_methods()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& value : services_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (value->service->has_synchronous_methods()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       has_sync_methods = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (!has_sync_methods) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      if ((*plugin)->has_sync_methods()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for (const auto& value : plugins_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (value->has_sync_methods()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         has_sync_methods = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -331,8 +329,8 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   //     server 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   //  2. cqs_: Completion queues added via AddCompletionQueue() call 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto it = sync_server_cqs->begin(); it != sync_server_cqs->end(); ++it) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    grpc_server_register_completion_queue(server->server_, (*it)->cq(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& value : *sync_server_cqs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    grpc_server_register_completion_queue(server->server_, value->cq(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           nullptr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     has_frequently_polled_cqs = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -347,8 +345,8 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // calling Next() or AsyncNext()) and hence are not safe to be used for 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // listening to incoming channels. Such completion queues must be registered 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   // as non-listening queues 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto it = cqs_.begin(); it != cqs_.end(); ++it) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    grpc_server_register_completion_queue(server->server_, (*it)->cq(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& value : cqs_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    grpc_server_register_completion_queue(server->server_, value->cq(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                           nullptr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -358,15 +356,14 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return nullptr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto service = services_.begin(); service != services_.end(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       service++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (!server->RegisterService((*service)->host.get(), (*service)->service)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& value : services_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (!server->RegisterService(value->host.get(), value->service)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return nullptr; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    (*plugin)->InitServer(initializer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& value : plugins_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    value->InitServer(initializer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (generic_service_) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -374,8 +371,8 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } else if (callback_generic_service_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     server->RegisterCallbackGenericService(callback_generic_service_); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    for (auto it = services_.begin(); it != services_.end(); ++it) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      if ((*it)->service->has_generic_methods()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for (const auto& value : services_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (value->service->has_generic_methods()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         gpr_log(GPR_ERROR, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "Some methods were marked generic but there is no " 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 "generic service registered."); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -400,8 +397,8 @@ std::unique_ptr<grpc::Server> ServerBuilder::BuildAndStart() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   auto cqs_data = cqs_.empty() ? nullptr : &cqs_[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   server->Start(cqs_data, cqs_.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    (*plugin)->Finish(initializer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  for (const auto& value : plugins_) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    value->Finish(initializer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return server; 
			 |