19 {
20 std::vector<std::pair<int, int>>
result;
21
22
23 if (s.size()<7)
return result;
24
25 const bool is_valid = (s.front() == '{') and (s.back() == '}');
26 if (not is_valid)
return result;
27 auto is_digit=[](const char c)->bool{
28 return (c>='0') and (c<='9');
29 };
30 auto is_quote=[](const char c)->bool{
31 return (c=='"');
32 };
33 const auto *
pc=
s.data();
34 const auto *
const pcEnd=
pc+
s.size();
37 static constexpr std::errc success{};
38
39
41
42 pc=std::find_if(pc,pcEnd,is_quote);
43
44
45 const auto &[
ptr, errCode] = std::from_chars(++pc, pcEnd, hash);
46 if (errCode!= success){
47 throw std::runtime_error("Bad hash conversion from database string in PixelConditionsAlgorithms::parseDeadMapString:" +s+".");
48 }
49
50 pc=std::find_if(ptr,pcEnd,is_digit);
51 const auto &[ptr2, errCode2] = std::from_chars(pc, pcEnd, status);
52 if (errCode2!= success){
53 throw std::runtime_error("Bad status conversion from database string in PixelConditionsAlgorithms::parseDeadMapString:"+s+".");
54 }
56 result.emplace_back(hash, status);
57 }
58
59
61 }