Result types module
Result and error types.
Instead of using exceptions, scn::scan
and others return an object of type scn::
, wrapped inside a scn::
.
Classes
-
template <typename T, typename E>class scn::v3::expected
- class scn::v3::scan_error
-
template <typename T>struct scn::v3::scan_expected
Functions
-
template <typename Result, typename... Args>auto make_scan_result(scan_expected<Result>&& result, std::
tuple<Args...>&& args) → scan_expected< scan_result< Result, Args... >> -> auto
Function documentation
template <typename Result, typename... Args>
auto make_scan_result(scan_expected<Result>&& result,
std:: tuple<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::make_scan_result(scn::vscan(...), std::move(args.args()));
Example:
auto args = scn::make_scan_args<scan_context, Args...>(); auto result = scn::vscan(std::forward<Source>(source), format, args); return scn::make_scan_result(std::move(result), std::move(args.args()));