chsvlib
chsv helper source code

◆ u8_encode_string() [8/8]

std::basic_string<char, CharTraits, Allocator> Chusov::String::u8_encode_string ( InputIterator  it,
std::size_t  count 
)

Converts a given string of Unicode code points to its UTF-8 representation and returns the latter as a C++ string object.

Template Parameters
CharTraitsis a CharTraits object used to instantiate the std::basic_string template and create the output string. By default it resolves to
std::char_traits<char>
.
Allocatoris an Allocator object to instantiate the std::basic_string to produce the type of the resulting string. By default it resolves to
std::allocator<char>
.
Parameters
itis an input iterator of Unicode code points represented by the ucp_t type.
countis a number of code points, starting from the position associated with it, used to construct the output string.
Returns
A newly created multi-byte char based C++ string object holding the UTF-8 representation of the input Unicode code point string.
Exceptions
Chusov::Exceptions::InvalidCharSequenceExceptionThe input string is detected to contain invalid code points.