-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Use _Verify_ranges_do_not_overlap in more places
#5495
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
and you can see where I copied the death test from
|
libc++ tests fail specifically due to this:
They have: std::array<S, 4> in = {{{4, 2}, {1, 3}, {3, 4}, {3, 5}}};
std::array<S, 2> out;
auto ret = std::ranges::copy_if(in.begin(), in.end(), out.begin(), [](int i) { return i == 3; }, &S::val); |
|
LLVM-139464 created. Now that copycats are not enforced to have non-overlap, this looks even less useful. |
I think that standard shoould have a weaker precondition here. Just dest not in [first, last) |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
⛰️ ❌ 🏔️ |
For the record, this is now LWG-4262 |
Resolves #5472.
Only used the function in the places where it is a perfect match. So no
ranges::swap_rangeswith two sentinels, and nostd::copyetc with weaker precondition.I was very surprised to learn that
copy_if/remove_copy/remove_copy_if/unique_copyrequire non-overlap as follows:This implies that the destination range may fit the same element number as the source range contains. I thought only fitting the actually returned number of elements is enough.
Overall, now as I've done this, I'm not even sure if it is at all useful.