Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BEGINRELEASENOTES
RelationRange
fulfill thestd::ranges::view
andstd::ranges::borrowed_range
conceptsENDRELEASENOTES
As suggested in #626 (comment) adding tests for checking whether
RelationRange
is a std range - it is.Since the
RelationRange
is a very lightweight, non-owning view it can fulfill two more concepts that can be used by the std range algorithms and adapters to avoid unneeded operations:view
- it's cheap to move/copy as it stores only iterators to the data living elsewhereborrowed_range
- the iterators taken from range remain valid even when the range is destroyed since they are not local to the rangeThe
RelationRange
is very similar tostd::span
andstd::ranges::subrange
and could potential replaced by them except for two differences:RealationRange
hasat
for bound-check element access whereas the alternatives don't (until C++26)RelationRange
element access returns copy whereas the alternatives would return const reference. Since the elements are podio objects then copy is preferred.The
RelationRange
could be also re-implemented withstd::ranges::view_interface
but it comes with issues like above so I think isn't really worth it