-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: Fix prevector iterator concept issues #29275
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
fac987a
to
fad74bb
Compare
Fixed libc++ CIs |
Can we split the fixes from the C++20 stuff? The latter shouldn't be backported... |
While it is safe to backport, I don't anything should be backported, unless there is a reason and need. A missing (default) constructor, if it was needed, would result in a compile failure. Given that the previous releases compile, this is not needed. Similar arguments can be made for the other commits. In any case, every commit is already a separate commit, so it is not possible to split further. Anyone is free to backport any or all commits, or none at all. |
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.
ACK fad74bb
Could the bitdeque
iterator also get std::contiguous_iterator_tag
?
No. As opposed to std::vector, the elements of a deque are not stored contiguously: typical implementations use a sequence of individually allocated fixed-size arrays, with additional bookkeeping, which means indexed access to deque must perform two pointer dereferences, compared to vector's indexed access which performs only one. (Copied from source: https://en.cppreference.com/w/cpp/container/deque) Also, even if a deque was contiguous, only |
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.
ACK fad74bb
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.
ACK fad74bb
Nice enhancements to safety, usability and standards.
Currently prevector iterators have many issues:
std::minmax_element
.const
issues with random access iterators. For example, aconst iterator
is different from aconst_iterator
, because the first one holds a mutable reference and must also return it withoutconst
. Also,operator+
must be callable regardless of the iterator object'sconst
-ness.x+n
andn+x
must be specified, see https://eel.is/c++draft/random.access.iterators#tab:randomaccessiteratorFix all issues.
Also, upgrade the
std::random_access_iterator_tag
(C++17) tostd::contiguous_iterator_tag
(C++20)