std::basic_string<char, CharTraitsTo, AllocatorTo> Chusov::String::u8_encode_string | ( | const BasicStringType & | str | ) |
Converts a given C++ string of Unicode code points to the corresponding UTF-8 representation as another C++ string object with custom char-traits policy and an allocator. .
CharTraitsTo | is a CharTraits object used to instantiate the std::basic_string template and create the output string. |
AllocatorTo | is an Allocator object to instantiate the std::basic_string to produce the type of the resulting string. |
BasicStringType | is an instantiation of the std::basic_string or (C++17) std::basic_string_view standard templates for the type Chusov::String::ucp_t. |
str | is a std::basic_string or (C++17) std::basic_string_view string object specialized for the Chusov::String::ucp_t characters. |
str
with the specified CharTraits and Allocator. Other overloads of u8_encode_string
(see below) allow omitting the specification of CharTraitsTo
and AllocatorTo
and use the traits and allocator templates of BasicStringType
respecialized for char
. BasicStringType
is an std::basic_string or (C++17) std::basic_string_view object with the traits_type
subtype be a template of one type argument. Use another template to encode a string stored within an arbitrary C++ Container. Chusov::Exceptions::InvalidCharSequenceException | The specified Unicode string is detected to contain an invalid Chusov::String::ucp_t code point. |
AllocatorTo
specification and use an allocator obtained from rebinding of an allocator of the input string str
. AllocatorTo
but also allows omission of the CharTraitsTo
parameter and uses a CharTraits policy of str
respecialized for char
. str
.