ICU-23303 document C++ Unicode string code point iterators#3830
ICU-23303 document C++ Unicode string code point iterators#3830markusicu wants to merge 4 commits intounicode-org:mainfrom
Conversation
|
@richgillam FYI |
| `++` and `--` for iteration, and `==` for comparing with iteration limits. | ||
| In fact, pointers to code units work as inputs to `UTFIterator`. However, they are not required. | ||
|
|
||
| When suppyling a pointer or a `contiguous_iterator` for the code units, then |
There was a problem hiding this comment.
| When suppyling a pointer or a `contiguous_iterator` for the code units, then | |
| When supplying a pointer or a `contiguous_iterator` for the code units, then |
| } | ||
| ``` | ||
|
|
||
| ## C++ code point iterators |
There was a problem hiding this comment.
| ## C++ code point iterators | |
| ## C++ code point iterators and ranges |
| ``` | ||
|
|
||
| This has a number of benefits compared with the C macros: | ||
| - These C++ APIs provide iterators and range adaptors that are |
There was a problem hiding this comment.
| - These C++ APIs provide iterators and range adaptors that are | |
| - These C++ APIs provide iterator and range adaptors that are |
The iterators are really iterator adaptors too.
|
|
||
| This has a number of benefits compared with the C macros: | ||
| - These C++ APIs provide iterators and range adaptors that are | ||
| compatible with the C++ standard library, and thus look and feel natural. |
There was a problem hiding this comment.
It’s not just that they look and feel natural, it also means they are composable with standard library utilities (especially in C++20 and later).
It might be worth showing one of the ranges-heavy C++20 examples from the test (as you did in your UTW slides), it’s going to be more discoverable here than in the test, and the existing example only really showcases C++11-level constructs.
| - These C++ APIs provide iterators and range adaptors that are | ||
| compatible with the C++ standard library, and thus look and feel natural. | ||
| - Instead of raw pointer+length manipulation, | ||
| they work with a large variety of code unit iterators. |
There was a problem hiding this comment.
Might be worth illustrating or noting that this works with weaker iterators & ranges too?
richgillam
left a comment
There was a problem hiding this comment.
'm not one of the primary reviewers, but this looks really good to me...
Document the C++ Unicode string code point iterators that we added in ICU 78, and make some mild updates in other User Guide chapters related to strings and iterators.
Also document the “C++ header-only APIs” mechanism that we started using in ICU 76.
I am not trying to review the whole User Guide, nor even all of the chapters I touched, for possible updates.
Checklist