std::text_encoding::text_encoding - cppreference.com
From cppreference.com
|
|
(1) | (since C++26) |
|
|
(2) | (since C++26) |
|
|
(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').
3) 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.
Parameters
| enc | - | character encoding name |
| i | - | MIBenum value |
Example
View on Compiler Explorer.
#include <text_encoding> int main() { constexpr std::text_encoding iso60 = 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")); }