Result types module
Result and error types.
Instead of using exceptions, scn:: and others return an object of type scn::, wrapped inside a scn::.
Classes
-
template <typename T, typename E>class scn::expected
- class scn::scan_error
-
template <typename T>struct scn::scan_expected
Functions
-
template <typename Result, typename Context, typename... Args>auto make_scan_result(scan_expected<Result>&& result, scan_arg_store<Context, Args...>&& args) → scan_expected< scan_result< Result, Args... >> -> auto
Function documentation
template <typename Result, typename Context, typename... Args>
auto make_scan_result(scan_expected<Result>&& result,
scan_arg_store<Context, Args...>&& args) → scan_expected< scan_result< Result, Args... >>
Convenience function to construct the value to return from scan, based on the return value of vscan, and the argument store.
Takes its arguments by rvalue reference to disallow extraneous copying.
Note: Because vscan places the values it scanned into the argument store passed to it, the call to make_scan_result needs to happen strictly after calling vscan. This means, that this is UB: return scn::
Example:
auto args = scn::make_scan_args<Source, Args...>(); auto result = scn::vscan(std::forward<Source>(source), format, args); return scn::make_scan_result(std::move(result), std::move(args));