Skip to content
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

Two helper ranges to simplify the rewriting of co-routines to C++17 #1892

Merged
merged 10 commits into from
Mar 28, 2025

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Mar 20, 2025

This introduces CachingTransformInputRange and CachingContinuableTransformInputRange, two abstractions that will make the porting from C++20 generators to C++17 easier.

CachingTransformInputRange is similar to ranges::transform, but caches the intermediate results by value and always is an InputRange. This is closer to the behavior of coroutines than ranges::transform which in particular recomputes the transformation if the same iterator is dereferenced multiple times.

CachingContinuableTransformInputRange in addition has special return values for the transformation which can control the iteration, e.g. Continue (skip the current element).

joka921 added 2 commits March 20, 2025 10:33
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
and this seems to work.

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 93.22034% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.61%. Comparing base (8444a5e) to head (b8d4057).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/util/InputRangeUtils.h 92.98% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1892      +/-   ##
==========================================
+ Coverage   90.58%   90.61%   +0.02%     
==========================================
  Files         413      414       +1     
  Lines       40041    40100      +59     
  Branches     4528     4536       +8     
==========================================
+ Hits        36272    36335      +63     
+ Misses       2420     2416       -4     
  Partials     1349     1349              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

joka921 added 4 commits March 20, 2025 14:58
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

1-1 with Johannes, impressive stuff (easy to use by example, but not so easy to understand in depth and to design in the first place)

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Round 2 with Johannes, looks great

Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Looks good now, when the tests runs through, I will make another quick pass, write a description and merge it

@hannahbast hannahbast changed the title Some helper ranges to make the porting of coroutines simpler. Two helper ranges to simplify the rewriting of co-routines to C++17 Mar 21, 2025
@hannahbast hannahbast marked this pull request as ready for review March 21, 2025 18:58
@sparql-conformance
Copy link

@joka921 joka921 merged commit 90cac4b into ad-freiburg:master Mar 28, 2025
24 checks passed
@joka921 joka921 deleted the caching-transform branch March 28, 2025 07:48
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