| 191 | // [2]: https://stackoverflow.com/questions/1275665/at-which-n-does-binary-search-become-faster-than-linear-search-on-a-modern-cpu |
| 192 | |
| 193 | string Status::string(uint16_t code) |
| 194 | { |
| 195 | auto value = std::find_if( |
| 196 | std::begin(statuses), |
| 197 | std::end(statuses), |
| 198 | [code](const StatusDescription& sd) { return sd.code == code; }); |
| 199 | |
| 200 | if (value != std::end(statuses)) { |
| 201 | return value->description; |
| 202 | } |
| 203 | |
| 204 | // Fallback for unknown status codes. |
| 205 | return stringify(code); |
| 206 | } |
| 207 | |
| 208 | |
| 209 | bool isValidStatus(uint16_t code) |