A C++ "range" for validating iteration over all of the code points of a code unit range.
More...
template<typename CP32, UTFIllFormedBehavior behavior, typename Range>
class U_HEADER_ONLY_NAMESPACE::UTFStringCodePoints< CP32, behavior, Range >
A C++ "range" for validating iteration over all of the code points of a code unit range.
Call utfStringCodePoints() to have the compiler deduce the Range type.
UTFStringCodePoints is conditionally borrowed; that is, if Range is a borrowed range so is UTFStringCodePoints<CP32, behavior, Range>. Note that when given a range r that is an lvalue and is not a view, utfStringCodePoints(r) uses a ref_view of r as the Range type, which is a borrowed range. In practice, this means that given a container variable r, the iterators of utfStringCodePoints(r) can be used as long as iterators on r are valid, without having to keep utfStringCodePoints(r) around. For instance:
std::u8string s = "𒇧𒇧";
auto it = utfStringCodePoints<char32_t>(s).begin();
++it;
char32_t second_code_point = it->codePoint();
- Template Parameters
-
| CP32 | Code point type: UChar32 (=int32_t) or char32_t or uint32_t; should be signed if UTF_BEHAVIOR_NEGATIVE |
| behavior | How to handle ill-formed Unicode strings |
| Range | A C++ "range" of Unicode UTF-8/16/32 code units |
- Draft:
- This API may be changed in the future versions and was introduced in ICU 78
- See also
- utfStringCodePoints
Definition at line 1777 of file utfiterator.h.
template<typename CP32 , UTFIllFormedBehavior behavior, typename Range >
template<typename R = Range, typename = std::enable_if_t<std::is_reference_v<R>>, typename = void>
Constructs a C++ "range" object over the code points in the string, keeping a reference to the code unit range.
This overload is used by utfStringCodePoints in C++17; in C+20, a ref_view is used instead (via views::all).
- Parameters
-
- Draft:
- This API may be changed in the future versions and was introduced in ICU 78
Definition at line 1802 of file utfiterator.h.