This impliciy heap allocation is unnecessary.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
uri = str;
}
- std::string get_uri() const
+ std::string_view get_uri() const
{
return uri;
}
- std::string get_fin_thread_name() const
+ std::string_view get_fin_thread_name() const
{
return fin_thread_name;
}
std::map<std::string, std::string> result;
std::lock_guard l(lock);
for (const auto& [name, module] : modules) {
- std::string svc_str = module->get_uri();
+ const std::string_view svc_str = module->get_uri();
if (!svc_str.empty()) {
- result[name] = svc_str;
+ result.emplace(name, svc_str);
}
}