mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +00:00
common/str_list: get_str_set(), add second param for template
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
parent
4f47d987cd
commit
72e8e1c76e
@ -75,10 +75,3 @@ void get_str_set(const string& str, set<string>& str_set)
|
||||
const char *delims = ";,= \t";
|
||||
get_str_set(str, delims, str_set);
|
||||
}
|
||||
|
||||
set<string> get_str_set(const string& str, const char *delims)
|
||||
{
|
||||
set<string> result;
|
||||
get_str_set(str, delims, result);
|
||||
return result;
|
||||
}
|
||||
|
@ -86,13 +86,22 @@ extern void get_str_set(const std::string& str,
|
||||
* @param [in] delims characters used to split **str**
|
||||
* @param [out] str_list Set modified containing str after it has been split
|
||||
**/
|
||||
extern void get_str_set(const std::string& str,
|
||||
const char *delims,
|
||||
std::set<std::string>& str_list);
|
||||
template<class Compare = std::less<std::string> >
|
||||
void get_str_set(const std::string& str,
|
||||
const char *delims,
|
||||
std::set<std::string, Compare>& str_list)
|
||||
{
|
||||
str_list.clear();
|
||||
for_each_substr(str, delims, [&str_list] (auto token) {
|
||||
str_list.emplace(token.begin(), token.end());
|
||||
});
|
||||
}
|
||||
|
||||
std::set<std::string> get_str_set(const std::string& str,
|
||||
const char *delims = ";,= \t");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return a String containing the vector **v** joined with **sep**
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user