Skip to content

Conversation

@markusicu
Copy link
Member

@markusicu markusicu commented Dec 29, 2025

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

  • Required: Issue filed: ICU-23303
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-NNNNN Fix xyz"
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-NNNNN Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable
  • Approver: Feel free to merge on my behalf

@markusicu
Copy link
Member Author

@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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.
Copy link
Member

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.
Copy link
Member

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?

Copy link
Contributor

@richgillam richgillam left a 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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants