Skip to content

using ranges #942

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

Merged
merged 3 commits into from
Apr 28, 2025
Merged

using ranges #942

merged 3 commits into from
Apr 28, 2025

Conversation

lemire
Copy link
Member

@lemire lemire commented Apr 26, 2025

Self-explanatory.

@lemire lemire requested review from Copilot and anonrig April 26, 2025 16:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the codebase to utilize C++ ranges for cleaner and more modern algorithm calls. The changes focus on replacing traditional iterator-based constructs (such as std::any_of and std::find_if) with range-based equivalents to improve readability and maintainability.

  • Updated header inclusions to include where needed.
  • Replaced iterator-based algorithm calls with std::ranges and std::views for clarity.
  • Adjusted substring operations for percent encoding improvements.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/url_aggregator.cpp Replaced std::any_of with std::ranges::any_of and improved substring usage for scheme parsing.
src/url.cpp Updated forbidden host character check to use std::ranges::any_of for smoother code.
src/unicode.cpp Switched std::any_of and std::find_if to their std::ranges equivalents, streamlining the functions.
src/parser.cpp Adjusted substring handling in URL parsing to use view.substr for clarity.
src/checkers.cpp Converted IPv4 hexadecimal check to use std::ranges::all_of with std::views::drop for conciseness.

@anonrig
Copy link
Member

anonrig commented Apr 26, 2025

It seems there are some build errors

@lemire
Copy link
Member Author

lemire commented Apr 28, 2025

@anonrig It is an issue with older LLVMs under Linux. I have changed the code, it should resolve the issue.

@anonrig anonrig merged commit 1f6a902 into main Apr 28, 2025
40 checks passed
@anonrig anonrig deleted the ranges branch April 28, 2025 16:13
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.

2 participants