diff --git a/icu4c/source/common/unicode/utfiterator.h b/icu4c/source/common/unicode/utfiterator.h index df3274c0be3..4c44ee5a17e 100644 --- a/icu4c/source/common/unicode/utfiterator.h +++ b/icu4c/source/common/unicode/utfiterator.h @@ -105,12 +105,12 @@ namespace header {} * #include * #include "unicode/utypes.h" * #include "unicode/utfiterator.h" - * + * * using U_HEADER_ONLY_NAMESPACE::utfIterator; * using U_HEADER_ONLY_NAMESPACE::utfStringCodePoints; * using U_HEADER_ONLY_NAMESPACE::unsafeUTFIterator; * using U_HEADER_ONLY_NAMESPACE::unsafeUTFStringCodePoints; - * + * * int32_t rangeLoop16(std::u16string_view s) { * // We are just adding up the code points for minimal-code demonstration purposes. * int32_t sum = 0; @@ -119,7 +119,7 @@ namespace header {} * } * return sum; * } - * + * * int32_t loopIterPlusPlus16(std::u16string_view s) { * auto range = utfStringCodePoints(s); * int32_t sum = 0; @@ -128,7 +128,7 @@ namespace header {} * } * return sum; * } - * + * * int32_t backwardLoop16(std::u16string_view s) { * auto range = utfStringCodePoints(s); * int32_t sum = 0; @@ -137,7 +137,7 @@ namespace header {} * } * return sum; * } - * + * * int32_t reverseLoop8(std::string_view s) { * auto range = utfStringCodePoints(s); * int32_t sum = 0; @@ -146,12 +146,12 @@ namespace header {} * } * return sum; * } - * + * * int32_t countCodePoints16(std::u16string_view s) { * auto range = utfStringCodePoints(s); * return std::distance(range.begin(), range.end()); * } - * + * * int32_t unsafeRangeLoop16(std::u16string_view s) { * int32_t sum = 0; * for (auto units : unsafeUTFStringCodePoints(s)) { @@ -159,7 +159,7 @@ namespace header {} * } * return sum; * } - * + * * int32_t unsafeReverseLoop8(std::string_view s) { * auto range = unsafeUTFStringCodePoints(s); * int32_t sum = 0; @@ -168,13 +168,13 @@ namespace header {} * } * return sum; * } - * + * * char32_t firstCodePointOrFFFD16(std::u16string_view s) { * if (s.empty()) { return 0xfffd; } * auto range = utfStringCodePoints(s); * return range.begin()->codePoint(); * } - * + * * std::string_view firstSequence8(std::string_view s) { * if (s.empty()) { return {}; } * auto range = utfStringCodePoints(s); @@ -185,7 +185,7 @@ namespace header {} * return {}; * } * } - * + * * template // some istream or streambuf * std::u32string cpFromInput(InputStream &in) { * // This is a single-pass input_iterator. @@ -199,7 +199,7 @@ namespace header {} * } * return s32; * } - * + * * std::u32string cpFromStdin() { return cpFromInput(std::cin); } * std::u32string cpFromWideStdin() { return cpFromInput(std::wcin); } * \endcode diff --git a/icu4c/source/test/intltest/utfiteratortest.cpp b/icu4c/source/test/intltest/utfiteratortest.cpp index 717524652b8..5fb47df28be 100644 --- a/icu4c/source/test/intltest/utfiteratortest.cpp +++ b/icu4c/source/test/intltest/utfiteratortest.cpp @@ -388,10 +388,8 @@ void Safe16::testFwdIter() { std::u16string_view good(u"abçカ🚴"sv); FwdIter goodBegin(good.data()); FwdIter goodLimit(good.data() + good.length()); - auto rangeBegin = utfIterator(goodBegin, goodLimit); + auto iter = utfIterator(goodBegin, goodLimit); auto rangeLimit = utfIterator(goodLimit); - // TODO: UTFStringCodePoints range(good); - auto iter = rangeBegin; assertTrue( "forward_iterator_tag", std::is_same_v< @@ -520,10 +518,8 @@ void Safe8::testFwdIter() { std::string_view good(reinterpret_cast(u8"abçカ🚴")); FwdIter goodBegin(good.data()); FwdIter goodLimit(good.data() + good.length()); - auto rangeBegin = utfIterator(goodBegin, goodLimit); + auto iter = utfIterator(goodBegin, goodLimit); auto rangeLimit = utfIterator(goodLimit); - // TODO: UTFStringCodePoints range(good); - auto iter = rangeBegin; assertTrue( "forward_iterator_tag", std::is_same_v< @@ -655,10 +651,8 @@ void Safe32::testFwdIter() { std::u32string_view good(U"abçカ🚴"sv); FwdIter goodBegin(good.data()); FwdIter goodLimit(good.data() + good.length()); - auto rangeBegin = utfIterator(goodBegin, goodLimit); + auto iter = utfIterator(goodBegin, goodLimit); auto rangeLimit = utfIterator(goodLimit); - auto iter = rangeBegin; - // TODO: UTFStringCodePoints range(good); assertTrue( "forward_iterator_tag", std::is_same_v<