Skip to content

Fix #946: Add standard iterator traits to CharPointer_UTF8 for compat… #1562

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

killerdevildog
Copy link

Fixes #946: Add standard iterator traits to CharPointer_UTF8 for compatibility with std algorithms

  • Added value_type, pointer, reference, iterator_category, and difference_type typedefs
  • Enables CharPointer_UTF8 to work with standard library algorithms like std::all_of
  • Uses random_access_iterator_tag as the most appropriate category for UTF-8 character iteration (since operations like + and - are supported, even if O(n) due to decoding)
  • Maintains full backward compatibility with existing code
  • Tested with both GCC and Clang compilers, including the repro from the issue and edge cases like empty strings and multi-byte UTF-8 characters

Thank you for submitting a pull request.

Please make sure you have read and followed our contribution guidelines (.github/contributing.md in this repository). Your pull request will not be accepted if you have not followed the instructions.

As a side note, I think that the policy described in CONTRIBUTING.md—where PRs are not merged directly into public branches but reproduced in the private repository—could potentially undervalue contributors by not preserving their commit history, authorship, or direct recognition in the public repo. While I understand the need for controlled integration in a hybrid open-source/commercial project, this approach might feel a bit unethical or discouraging to community members who invest time in fixes, as it limits visibility of their contributions (e.g., no GitHub credit for merges). Perhaps considering ways to attribute reproduced changes publicly, like mentioning contributors in changelogs or commit messages, could help maintain motivation and fairness. I'd be interested in the team's thoughts on this if possible!

…TF8 for compatibility with std algorithms

- Added value_type, pointer, reference, iterator_category, and difference_type typedefs
- Enables CharPointer_UTF8 to work with standard library algorithms like std::all_of
- Uses input_iterator_tag as the most appropriate category for UTF-8 character iteration
- Maintains full backward compatibility with existing code
- Tested with both GCC and Clang compilers
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.

Some custom iterators are incompatible with standard algorithms
1 participant