From: Kefu Chai Date: Sat, 8 May 2021 08:43:55 +0000 (+0800) Subject: crimson/common: use string_view when appropriate X-Git-Tag: v17.1.0~2031^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F41234%2Fhead;p=ceph.git 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 --- diff --git a/src/crimson/common/config_proxy.h b/src/crimson/common/config_proxy.h index f7611a6b4fc55..e56a6825f41c3 100644 --- a/src/crimson/common/config_proxy.h +++ b/src/crimson/common/config_proxy.h @@ -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 - const T get_val(const std::string& key) const { + const T get_val(std::string_view key) const { return get_config().template get_val(*values, key); }