-
-
Notifications
You must be signed in to change notification settings - Fork 856
ICU-23303 document C++ Unicode string code point iterators #3830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'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