8000 [FIX] gcc15: conditionally borrowed_range views by eseiler · Pull Request #3360 · seqan/seqan3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[FIX] gcc15: conditionally borrowed_range views #3360

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 1 commit into from
Apr 14, 2025

Conversation

eseiler
Copy link
Member
@eseiler eseiler commented Apr 14, 2025

gcc15 now implements std::ranges::to

For std::string (as example), the call is delegated to std::string(std::from_range, R &&).
This then will use std::ranges::data to get the data pointer and just copy the data.

This happens, for example, in format_sam's id | detail::take_until_and_consume(is_space) | ranges::to<id_type>().
Since the view is not an lvalue, it needs to be a borrowed_range for std::ranges::data to work.

Similar to std::views, we make (some of) our views conditionally borrowed if the underlying range is borrowed.

Edit: The problem of calling std::ranges::data on non-borrowed ranges in the std::string range constructor is now also fixed in GCC. I was aware that this is likely a bug in GCC, but I found it worth making the views borrowed because it allows for optimizations (memcpy instead of iteration).

gcc15 now implements std::ranges::to
For `std::string` (as example), the call is delegated to
`std::string(std::from_range, R &&)`.
This then will use `std::ranges::data` to get the data pointer and just
copy the data.
This happens, for example, in format_sam's
`id | detail::take_until_and_consume(is_space) | ranges::to<id_type>()`.
Since the view is not an lvalue, it needs to be a borrowed_range for
`std::ranges::data` to work.
Similar to std::views, we make (some of) our views conditionally
borrowed if the underlying range is borrowed.
@seqan-actions seqan-actions added lint [INTERNAL] signal for linting and removed lint [INTERNAL] signal for linting labels Apr 14, 2025
@seqan-actions
Copy link
Member

Documentation preview available at https://docs.seqan.de/preview/seqan/seqan3/3360

Copy link
codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.11%. Comparing base (7f01aac) to head (e70c5e0).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3360   +/-   ##
=======================================
  Coverage   98.11%   98.11%           
=======================================
  Files         270      270           
  Lines       11913    11913           
  Branches      103      103           
=======================================
  Hits        11689    11689           
  Misses        224      224           

☔ 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.

@eseiler eseiler enabled auto-merge April 14, 2025 14:12
@eseiler eseiler requested a review from SGSSGene April 14, 2025 14:12
Copy link
Contributor
@SGSSGene SGSSGene left a comment

Choose a reason for hiding this comment

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

Very nice👌

@eseiler eseiler merged commit 5d07997 into seqan:main Apr 14, 2025
40 checks passed
@eseiler eseiler deleted the fix/ranges_to branch April 14, 2025 15:37
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.

3 participants
0