Remove another range-based for
Do not make explicit comparisons against nullptr; only use
implicit typecast to bool
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index 54feac3..243a056 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -54,7 +54,8 @@
: max_message_size_(-1), generic_service_(nullptr) {
grpc_compression_options_init(&compression_options_);
gpr_once_init(&once_init_plugin_list, do_plugin_list_init);
- for (auto factory : (*g_plugin_factory_list)) {
+ for (auto it = g_plugin_factory_list->begin(); it != g_plugin_factory_list->end(); it++) {
+ auto& factory = *it;
std::unique_ptr<ServerBuilderPlugin> plugin = factory();
plugins_[plugin->name()] = std::move(plugin);
}
@@ -103,7 +104,7 @@
bool has_sync_methods = false;
for (auto it = services_.begin(); it != services_.end(); ++it) {
if ((*it)->service->has_synchronous_methods()) {
- if (thread_pool == nullptr) {
+ if (!thread_pool) {
thread_pool.reset(CreateDefaultThreadPool());
has_sync_methods = true;
break;
@@ -115,7 +116,7 @@
(*option)->UpdateArguments(&args);
(*option)->UpdatePlugins(&plugins_);
}
- if (thread_pool == nullptr) {
+ if (!thread_pool) {
for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) {
if ((*plugin).second->has_sync_methods()) {
thread_pool.reset(CreateDefaultThreadPool());