This function determines whether or not the type is or contains a unicode encoding. This means any encoding wherein the entirety of Unicode, all 21 bits, can be represented without loss of information. For a full list of encodings which are considered Unicode Encodings by this library, see the Known Unicode Encodings list.

This function checks for 2 things.

  • It checks to see if the call encoding.contains_unicode_encoding() is well-formed and returns a boolean value. If this is the case, it calls encoding.contains_unicode_encoding() and returns that value.

  • It looks to see if the provided encoding has a member type called ::is_unicode_encoding. If this is the case, then it returns is_unicode_encoding_v<Type>.

If none of these work, then it returns false.

template<typename _Encoding>
constexpr bool ztd::text::contains_unicode_encoding(const _Encoding &__encoding) noexcept

Whether or not the provided encoding is a Unicode encoding.


This function first checks if there is a function called contains_unicode_encoding . If it is present, then it returns the value of that function directly. Otherwise, it checks if ztd::text::is_unicode_encoding_v is true for the provided __encoding . If that’s the case, then true is returned. Otherwise, it assumes the encoding is not a Unicode-compatible encoding and returns false.


__encoding – [in] The encoding to query.