The assume_valid_handler is a Undefined-Behavior invoking error handler. If an error is encountered, the encoding can legally ignore and never, ever call the error handler at all. This can invoke ☢️☢️Undefined Behavior☢️☢️ on malformed input.


⚠️ This should only ever be used on the most trusted of input, ever, and that input should never come from a source that is a user or connected to ANY external input sources such as the Network, Shared Pipe, Inter-Procedural Call, or similar.

Implementers of encodings within templates can check for a potentially ignorable error handler like this one using ztd::text::is_ignorable_error_handler_v.

constexpr assume_valid_handler_t ztd::text::assume_valid_handler = {}

An instance of the assume_valid_handler_t type for ease of use.

class assume_valid_handler_t

An error handler that tells an encoding that it will pass through any errors, without doing any adjustment, correction or checking.


This error handler is useful in conjunction with a ztd::text::ranges::unbounded_view for the fastest possible encoding and decoding in a general sense. However: IT IS ALSO EXTREMELY DANGEROUS AND CAN INVOKE UNDEFINED BEHAVIOR IF YOUR TEXT IS, IN FACT, MESSED UP. PLEASE DO NOT USE THIS WITHOUT A GOOD REASON!

Public Types

using assume_valid = ::std::integral_constant<bool, true>

A type that is true when calling code can not call this function and ignore it, and false when it cannot ignore it. See ztd::text::assume_valid_handler_t for details.

Public Functions

template<typename _Encoding, typename _Result, typename _InputProgress, typename _OutputProgress>
inline constexpr auto operator()(const _Encoding&, _Result __result, const _InputProgress&, const _OutputProgress&) const

A handler for either decode or encode results that simply passes the result type back through with no changes made.


__result[in] The current state of the encode operation to pass through.