-
Notifications
You must be signed in to change notification settings - Fork 685
chunked_vector: Various improvements #27969
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
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: Ben Pope <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the chunked_vector
iterator implementation to properly satisfy the C++20 random access iterator concept requirements. The changes ensure the iterator type aliases are correctly defined to support both const and non-const iterators while handling the special case of bool
type.
Key Changes
- Added
iterator_concept
type alias to explicitly declare random access iterator support - Fixed
value_type
to always beT
(not conditionally const) - Corrected
pointer
andreference
type aliases to properly handle const/non-const variants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we static assert this in tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we static assert this in tests?
Yeah, I think there's some more to come, but I'm not full time on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think this will work, right? doesn't random access iterators imply certain properties about the memory layout? stuff like for iterators a
and b
you can do pointer arithemetic with them that acts like the memory is contiguous?
There should be https://en.cppreference.com/w/cpp/iterator/contiguous_iterator.html for the difference between random access and contiguous, but maybe not everything respects that properly |
Not sure, but I the second bullet point under semantic requirements here https://en.cppreference.com/w/cpp/iterator/random_access_iterator.html is where I saw the pointer difference idea. |
Some improvements to chunked_vector:
Backports Required
Release Notes