|
9 | 9 | #include "Policies.h" |
10 | 10 | #include "Taps.h" |
11 | 11 | #include "CorradeCompat.h" |
| 12 | +#include <Corrade/Containers/PointerStl.h> |
12 | 13 | #include <Corrade/Utility/ConfigurationGroup.h> |
13 | 14 | #include <spdlog/sinks/stdout_color_sinks.h> |
14 | 15 | #include <spdlog/spdlog.h> |
@@ -63,7 +64,7 @@ void CoreRegistry::start(HttpServer *svr) |
63 | 64 | InputPluginPtr mod = _input_registry.instantiate(alias); |
64 | 65 | _logger->info("Load input stream plugin: {} version {} interface {}", alias, version, mod->pluginInterface()); |
65 | 66 | mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN()); |
66 | | - auto result = _input_plugins.insert({std::make_pair(corrade_to_std_string(alias), version), std::move(mod)}); |
| 67 | + auto result = _input_plugins.try_emplace(std::make_pair(corrade_to_std_string(alias), version), std::move(mod)); |
67 | 68 | if (!result.second) { |
68 | 69 | throw std::runtime_error(fmt::format("Input alias '{}' with version '{}' was already loaded.", alias, version)); |
69 | 70 | } |
@@ -93,7 +94,7 @@ void CoreRegistry::start(HttpServer *svr) |
93 | 94 | HandlerPluginPtr mod = _handler_registry.instantiate(s); |
94 | 95 | _logger->info("Load stream handler plugin: {} version {} interface {}", alias, version, mod->pluginInterface()); |
95 | 96 | mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN()); |
96 | | - auto result = _handler_plugins.insert({std::make_pair(corrade_to_std_string(alias), version), std::move(mod)}); |
| 97 | + auto result = _handler_plugins.try_emplace(std::make_pair(corrade_to_std_string(alias), version), std::move(mod)); |
97 | 98 | if (!result.second) { |
98 | 99 | throw std::runtime_error(fmt::format("Handler alias '{}' with version '{}' was already loaded.", alias, version)); |
99 | 100 | } |
|
0 commit comments