mirror of
https://github.com/ceph/ceph
synced 2025-01-18 09:02:08 +00:00
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:
parent
a46db0c127
commit
f3be0d8d81
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user