crimson/common: use string_view when appropriate

the typical use case of get_val() passes a literal string as the key,
in that case, there is no need to create a std::string. as
md_config_t::get_val() always accepts a string_view as the option name.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-05-08 16:43:55 +08:00
parent a46db0c127
commit f3be0d8d81

View File

@ -125,11 +125,11 @@ public:
}
});
}
int get_val(const std::string &key, std::string *val) const {
int get_val(std::string_view key, std::string *val) const {
return get_config().get_val(*values, key, val);
}
template<typename T>
const T get_val(const std::string& key) const {
const T get_val(std::string_view key) const {
return get_config().template get_val<T>(*values, key);
}