max_code_units

The maximum number of code units needed for a given encoding object. This can be used to create a suitably-sized automatic storage duration buffer, e.g.

using code_unit = ztd::text::code_unit_t<ztd::text::utf8>;
constexpr std::size_t max_output_size = ztd::text::max_code_units_v<ztd::text::utf8>;

// C++-style
std::array<code_unit, max_output_size> my_cxx_buffer;
// or C-style
code_unit my_c_buffer[max_output_size];
template<typename _Type>
static constexpr ::std::size_t ztd::text::max_code_units_v = remove_cvref_t<_Type>::max_code_units

Gets the maximum number of code units that can be produced by an encoding during an encode operation, suitable for initializing a automatic storage duration (“stack-allocated”) buffer.