| 125 | } |
| 126 | |
| 127 | static void replace_all(std::string & s, const std::string & search, const std::string & replace) { |
| 128 | std::string result; |
| 129 | for (size_t pos = 0; ; pos += search.length()) { |
| 130 | auto new_pos = s.find(search, pos); |
| 131 | if (new_pos == std::string::npos) { |
| 132 | result += s.substr(pos, s.size() - pos); |
| 133 | break; |
| 134 | } |
| 135 | result += s.substr(pos, new_pos - pos) + replace; |
| 136 | pos = new_pos; |
| 137 | } |
| 138 | s = std::move(result); |
| 139 | } |
| 140 | |
| 141 | static bool is_float_close(float a, float b, float abs_tol) { |
| 142 | // Check for non-negative tolerance |
no test coverage detected