From cppreference.com
constexprtext_encoding()=default; (1) (since C++26)constexprexplicittext_encoding(std::string_viewenc)noexcept; (2) (since C++26)constexprtext_encoding(std::text_encoding::idi)noexcept; (3) (since C++26)Constructs a new text encoding object.
1) Default constructor. Constructs an object with
value std::text_encoding::id::unknown and empty
.
If enc names a
other than NATS-DANO or NATS-DANO-ADD, then the constructed object will have the corresponding
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').
3) Constructs an object with
value i.
If i is std::text_encoding::id::other or std::text_encoding::id::unknown, then the constructed object will have empty
, otherwise it will have one of the
.
Parameters
enc - character encoding name i - MIBenum value Example
View on
.
Run this code
#include<text_encoding>intmain(){constexprstd::text_encodingiso60=std::text_encoding::ISO60DanishNorwegian;static_assert(iso60==std::text_encoding("csISO60DanishNorwegian"));static_assert(iso60==std::text_encoding("iso-ir-60"));static_assert(iso60==std::text_encoding("NS_4551-1"));}External links