| 8216 | */ |
| 8217 | template<typename NumberType> |
| 8218 | bool get_string(const input_format_t format, |
| 8219 | const NumberType len, |
| 8220 | string_t& result) |
| 8221 | { |
| 8222 | bool success = true; |
| 8223 | std::generate_n(std::back_inserter(result), len, [this, &success, &format]() |
| 8224 | { |
| 8225 | get(); |
| 8226 | if (JSON_UNLIKELY(not unexpect_eof(format, "string"))) |
| 8227 | { |
| 8228 | success = false; |
| 8229 | } |
| 8230 | return static_cast<char>(current); |
| 8231 | }); |
| 8232 | return success; |
| 8233 | } |
| 8234 | |
| 8235 | /*! |
| 8236 | @param[in] format the current format (for diagnostics) |
no test coverage detected