MCPcopy Create free account
hub / github.com/ceph/ceph / for_each_pair

Function for_each_pair

src/include/str_map.h:28–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27template <typename Func>
28void for_each_pair(std::string_view s, const char* delims, Func&& f)
29{
30 auto pos = s.find_first_not_of(delims);
31 while (pos != s.npos) {
32 s.remove_prefix(pos); // trim delims from the front
33 auto end = s.find_first_of(delims);
34 auto kv = s.substr(0, end);
35 if (auto equal = kv.find('='); equal != kv.npos) {
36 f(kv.substr(0, equal), kv.substr(equal + 1));
37 } else {
38 f(kv.substr(0, equal), std::string_view());
39 }
40 pos = s.find_first_not_of(delims, end);
41 }
42}
43
44using str_map_t = std::map<std::string,std::string>;
45

Callers 3

startMethod · 0.85
get_str_mapFunction · 0.85
set_metadataMethod · 0.85

Calls 3

fFunction · 0.85
substrMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected