make_encode_stateļƒ

This detects when the encode_state of a given encoding requires the encoding itself to make said state. If so, it will call the encode_stateā€˜s constructor with the encoding passed in. Otherwise, it simply default-constructs a state. In either case, the constructed value is returned to the user.

The classification for this is done by ztd::text::is_encode_state_independent.

template<typename _Encoding>
constexpr encode_state_t<remove_cvref_t<_Encoding>> ztd::text::make_encode_state(_Encoding &__encoding) noexceptļƒ

Constructs the encode_state of the given encoding, based on whether or not the encoding and state meet the criteria of ztd::text::is_encode_state_independent_v.

Parameters

__encoding ā€“ [in] The encoding object to use, if applicable, for the construction of the state.

template<typename _Encoding>
constexpr encode_state_t<remove_cvref_t<_Encoding>> ztd::text::make_encode_state_with(_Encoding &__encoding, const decode_state_t<remove_cvref_t<_Encoding>> &__decode_state) noexceptļƒ

Constructs the encode_state of the given encoding, based on whether or not the encoding and state meet the criteria of ztd::text::is_encode_state_independent_v or whether it can be created by copy construction from the given __decode_state.

Parameters
  • __encoding ā€“ [in] The encoding object to use, if applicable, for the construction of the state.

  • __decode_state ā€“ [in] A preexisting state from the decoder.