From f3be0d8d81155332e5fbaf0daadb0d682fa1f560 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 8 May 2021 16:43:55 +0800 Subject: [PATCH] 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 --- src/crimson/common/config_proxy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crimson/common/config_proxy.h b/src/crimson/common/config_proxy.h index f7611a6b4fc..e56a6825f41 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); }