Skip to content

Conversation

@jwakely
Copy link
Member

@jwakely jwakely commented Dec 11, 2025

A series of changes to make more use of modern C++20 features.

Several functions can be made more generic by using std::span instead of passing references to std::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.

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.
@jwakely jwakely force-pushed the ranges-ranges-ranges branch from a8ccbd2 to 569de89 Compare December 12, 2025 13:20
@jwakely
Copy link
Member Author

jwakely commented Dec 12, 2025

No changes to the generated HTML except as noted in one commit:

Add report_generator::make_sort_by_status_impl helper

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.

@jwakely jwakely force-pushed the ranges-ranges-ranges branch from 569de89 to 3653804 Compare December 12, 2025 13:29
Comment on lines +70 to +72
using Predicate = std::move_only_function<bool(lwg::issue const &)>;
#else
using Predicate = std::function<bool(lwg::issue const &)>;

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

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.

Copy link
Member Author

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.

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;) {

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.

Copy link
Member Author

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);

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())

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.

Copy link

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

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