Landing: 7239744d25da

Project / Subsystem

gcc / libstdc++

Date

2026-04-24

Author

Tomasz Kamiński

Commit

7239744d25dadf39f431dfe38f3c03942acdb979

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
commit_hash
7239744d25dadf39f431dfe38f3c03942acdb979
source_type
github
headline
Libstdc++: Make ref_view<R> statically sized if R has static size
tldr
Makes `ref_view<R>` statically sized when the underlying range `R` has a static size, avoiding runtime dereferences.
author
Tomasz Kamiński
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • libstdc++
  • ranges
  • static_size
  • optimization
discussion_id_link
bugzilla_pr
date
2026-04-24T00:00:00.000Z

This commit enhances the ref_view in libstdc++ to leverage static size information when available in the underlying range. The change introduces a ranges::__static_size helper function that returns the size of a statically-sized range. This allows ref_view to avoid potentially unsafe dereferences of pointer values at runtime when the size is known at compile time, enabling compile-time optimizations for ranges with static sizes.