-
Notifications
You must be signed in to change notification settings - Fork 32
Ranges ranges ranges #533
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: master
Are you sure you want to change the base?
Ranges ranges ranges #533
Conversation
Also replace some loops with range-based for.
Common impl for make_sort_by_status and make_sort_by_status_mod_date. This changes the generated HTML slightly, because it means that the lwg-status.html, unresolved-status.html, and voting-status.html pages now have OpenGraph metadata: --- mailing.orig/lwg-status.html 2025-12-10 23:22:08.142390521 +0000 +++ mailing.good/lwg-status.html 2025-12-11 11:57:02.753796799 +0000 @@ -3,6 +3,12 @@ <head> <meta charset="utf-8"> <title>LWG Index by Status and Section</title> +<meta property="og:title" content="LWG Index by Status and Section"> +<meta property="og:description" content="C++ standard library issues list"> +<meta property="og:url" content="https://cplusplus.github.io/LWG/lwg-status.html"> +<meta property="og:type" content="website"> +<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png"> +<meta property="og:image:alt" content="C++ logo"> <style> p {text-align:justify} li {text-align:justify} This seems like a good change. It makes those pages consistent with the equivalent *-status-date.html pages. The *-status-date.html pages get an extra blank line in the HTML as well, because all those *-status*.html pages are generated by the same function now.
a8ccbd2 to
569de89
Compare
|
No changes to the generated HTML except as noted in one commit: |
…jections Ranges algos can just use a pointer-to-member projection instead.
Also remove outdated comment and alternative code that is no simpler.
569de89 to
3653804
Compare
| using Predicate = std::move_only_function<bool(lwg::issue const &)>; | ||
| #else | ||
| using Predicate = std::function<bool(lwg::issue const &)>; |
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.
I would use: std::move_only_function<bool(lwg::issue const &) const>, mutable filters are questionable
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.
But this feel like a change for the sake of change, until we get function_ref.
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.
True, I was thinking it makes it clear there's no copy ... but no actual copy happens in practice so it doesn't really achieve anything. I'll drop this commit from the PR.
src/report_generator.cpp
Outdated
| out << "<p>" << build_timestamp << "</p>"; | ||
|
|
||
| for (auto i = issues.cbegin(), e = issues.cend(); i != e;) { | ||
| for (auto i = issues.begin(), e = issues.end(); i != e;) { |
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.
Maybe use chunk_by(issues, [](const issue& lhs, const& issue rhs) { return lhs.stat != rhs.stat; }); if we can depend on that.
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.
The code is compiled with -std=c++20 currently. We could change that, if everybody working with the issues has a compiler that can handle C++23.
| } | ||
| std::pair<unsigned, unsigned> count_issues(std::span<const std::pair<int, std::string>> issues) { | ||
| using pair_type = decltype(issues)::value_type; | ||
| auto n_open = std::ranges::count_if(issues, is_active, &pair_type::second); |
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.
std::ranges::count_if(issues | views::elements<1>, is_active).
| out << "<h2 id=\"" << idattr << "\">" << current_status << " (" << (j-i) << " issues)</h2>\n"; | ||
| print_table(out, {i, j}, section_db); | ||
| i = j; | ||
| while (!issues.empty()) |
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.
This also seem like chunk_by.
tomaszkam
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.
LGTM. I have noted a few places where you could improve by using chunk_by.
A series of changes to make more use of modern C++20 features.
Several functions can be made more generic by using
std::spaninstead of passing references tostd::vector.Some loops are changed to loop over a span and remove the prefix that has been processed.
Using projections with ranges algos simplifies several places.