Skip to content

4.0.0

Compare
Choose a tag to compare
@eliaskosunen eliaskosunen released this 03 Nov 22:16
· 12 commits to master since this release
f877beb

Breaking changes

  • scanner::parse now returns Iterator, not scan_expected<Iterator>
    • Errors are reported by throwing a scan_format_string_error, or by calling ParseContext::on_error.
  • Optimize the way scan calls vscan to remove extra copies/moves
// Dummy-implementation of `scan`
// Before (v3):
auto args = make_scan_args<scan_context, Args...>();
auto result = vscan(std::forward<Source>(source), format, args);
return make_scan_result(std::move(result), std::move(args.args()));

// Now (v4):
auto result = make_scan_result<Source, Args...>();
fill_scan_result(result, vscan(std::forward<Source>(source), format,
                               make_scan_args(result->values())));
return result;
  • Changes to scan_error
    • Success state removed: use expected<void, scan_error> instead.
    • scan_error::value_out_of_range split into value_positive_overflow, value_negative_overflow,
      value_positive_underflow, and value_negative_overflow.
    • end_of_range renamed to end_of_input.
    • invalid_literal, invalid_fill, length_too_short, and invalid_source_state added.
  • basic_scan_context is now templated on the range type

Features

  • <chrono> scanning
  • Scanning of pointers (void* and const void*)
  • Ability to disable dependency on FastFloat with SCN_DISABLE_FAST_FLOAT
    • FastFloat used to be the only required external dependency
    • If disabled, std::from_chars for floating-point values is required

Changes

  • Deprecate visit_scan_arg, add basic_scan_arg::visit
  • Remove thousands separator checking when scanning localized numbers
  • scan_error::invalid_source_state is now returned if syncing with the underlying source fails after scan
    (like for example, std::ungetc fails)

Full Changelog: v3.0.2...v4.0.0