std::text_encoding::text_encoding
From cppreference.com
< cpp | text | text encoding
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Text processing library
Regular expressions library (C++11)
Formatting library (C++20)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++26)
std::text_encoding
text_encoding::text_encoding
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円').
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.
Behavior is undefined if i is not a named enumerator of
std::text_encoding::id
.[edit] Parameters
enc
-
character encoding name
i
-
MIBenum value
[edit] Example
View on Compiler Explorer.
Run this code
#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")); }