std::text_encoding::text_encoding - cppreference.com (original) (raw)

constexpr text_encoding() = default; (1) (since C++26)
constexpr explicit text_encoding( std::string_view enc ) noexcept; (2) (since C++26)
constexpr text_encoding( std::text_encoding::id i ) noexcept; (3) (since C++26)

Constructs a new text encoding object.

  1. Default constructor. Constructs an object with MIBenum value std::text_encoding::id::unknown and empty character encoding name.

If enc names a registered character encoding other than NATS-DANO or NATS-DANO-ADD, then the constructed object will have the corresponding MIBenum value, otherwise it will have MIBenum std::text_encoding::id::other.

Behavior is undefined if enc.size() > std::text_encoding::max_name_length || enc.contains('\0').

  1. Constructs an object with MIBenum value i.

If i is std::text_encoding::id::other or std::text_encoding::id::unknown, then the constructed object will have empty character encoding name, otherwise it will have one of the corresponding names.

[edit] Parameters

enc - character encoding name
i - MIBenum value

[edit] Example

View on Compiler Explorer.