From: Kefu Chai Date: Mon, 19 Feb 2018 02:55:02 +0000 (+0800) Subject: common/str_list: s/boost::string_view/std::string_view X-Git-Tag: v13.0.2~219^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F20475%2Fhead;p=ceph.git common/str_list: s/boost::string_view/std::string_view since string_view is include by standard library, we can now switch from boost::string_view to std::string_view. Signed-off-by: Kefu Chai --- diff --git a/src/common/cmdparse.cc b/src/common/cmdparse.cc index 51a9c1abed36..57502a25482a 100644 --- a/src/common/cmdparse.cc +++ b/src/common/cmdparse.cc @@ -41,7 +41,7 @@ std::string cmddesc_get_prefix(const std::string &cmddesc) return result.str(); } -using arg_desc_t = std::map; +using arg_desc_t = std::map; // Snarf up all the key=val,key=val pairs, put 'em in a dict. template @@ -396,7 +396,7 @@ int parse_osd_id(const char *s, std::ostream *pss) namespace { template -bool find_first_in(boost::string_view s, const char *delims, Func&& f) +bool find_first_in(std::string_view s, const char *delims, Func&& f) { auto pos = s.find_first_not_of(delims); while (pos != s.npos) { @@ -443,8 +443,8 @@ bool arg_in_range(T value, const arg_desc_t& desc, std::ostream& os) { return true; } -bool validate_str_arg(boost::string_view value, - boost::string_view type, +bool validate_str_arg(std::string_view value, + std::string_view type, const arg_desc_t& desc, std::ostream& os) { @@ -482,8 +482,8 @@ template& str_list) { str_list.clear(); - for_each_substr(str, delims, [&str_list] (boost::string_view token) { + for_each_substr(str, delims, [&str_list] (auto token) { str_list.emplace_back(token.begin(), token.end()); }); } @@ -44,7 +44,7 @@ list get_str_list(const string& str, const char *delims) void get_str_vec(const string& str, const char *delims, vector& str_vec) { str_vec.clear(); - for_each_substr(str, delims, [&str_vec] (boost::string_view token) { + for_each_substr(str, delims, [&str_vec] (auto token) { str_vec.emplace_back(token.begin(), token.end()); }); } @@ -65,7 +65,7 @@ vector get_str_vec(const string& str, const char *delims) void get_str_set(const string& str, const char *delims, set& str_set) { str_set.clear(); - for_each_substr(str, delims, [&str_set] (boost::string_view token) { + for_each_substr(str, delims, [&str_set] (auto token) { str_set.emplace(token.begin(), token.end()); }); } diff --git a/src/include/str_list.h b/src/include/str_list.h index 7f5e71659c03..c8fa914832ce 100644 --- a/src/include/str_list.h +++ b/src/include/str_list.h @@ -11,9 +11,9 @@ namespace ceph { /// Split a string using the given delimiters, passing each piece as a -/// (non-null-terminated) boost::string_view to the callback. -template // where Func(boost::string_view) is a valid call -void for_each_substr(boost::string_view s, const char *delims, Func&& f) +/// (non-null-terminated) std::string_view to the callback. +template // where Func(std::string_view) is a valid call +void for_each_substr(std::string_view s, const char *delims, Func&& f) { auto pos = s.find_first_not_of(delims); while (pos != s.npos) { diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 20c4c58c1293..2dadc9250248 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -350,7 +350,7 @@ int RocksDBStore::load_rocksdb_options(bool create_if_missing, rocksdb::Options& "rocksdb_db_paths", [&opt, this](const std::string& paths) { ceph::for_each_substr( paths, "; \t", - [&paths, &opt, this](boost::string_view s) { + [&paths, &opt, this](auto s) { size_t pos = s.find(','); if (pos == std::string::npos) { derr << __func__ << " invalid db path item " << s << " in "