-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
P2321R2: Added std::views::zip
.
#3035
Conversation
After some investigation, it seems like the tests are failing because the LLVM libc++ test cases have a hardcoded exception to ensure that the feature test macro I'm going to remove the added definition of That works for now, but if the remainder of the paper is implemented and we should define the feature test macro, then what should we do? (I apologize if this is a common-sense question; this is my first contribution to this project.) |
You can skip the necessary libc++ tests for now, with a comment explaining why the tests are skipped (see Speaking of tests, it's probably a good idea to add a test for this implementation to make sure it conforms to the Standard. See |
In addition to defining a feature macro, should also update |
Refactored the implementation to remove recursion.
Thank you both for the very helpful advice! I just made the suggested changes to I also agree that test suites should be added for this implementation. I'll begin work on implementing some. |
* Include `<utility>` for `forward`. * Include `<cstddef>` for `size_t`. * Include `<type_traits>` for `add_const_t`. * Include `<memory>` for `addressof`.
We need to explicitly mark lambdas as noexcept. Note that tuple equality and spaceship aren't strengthened. For _Iterator operator==, I used _Zip_iterator_sentinel_equal (as the `if constexpr` is an optimization). For operator<=>, I dropped the strengthening. I believe that the _Size_closure can be unconditionally noexcept. In the test, ranges::min isn't strengthened, so we need to avoid expressing our expected result in terms of that.
Ok, I think we're good to go now! I've pushed another series of fine-grained commits. FYI @strega-nil-ms as I pushed these changes after you approved. (Halfway through making the |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
…PendingAmpErrors(), with C++23 zip_view".
…E in PackExpander.cpp, with C++23 zip_view".
…ymbol before it should find something this time, too" in ParseTree.cpp, with C++23 zip_view'.
I've pushed 3 commits to work around compiler assertions in the internal "checked" build, which I've duly reported. Internal links:
Congratulations on finding so many ways to improve the compiler! 😹 |
Thanks for implementing this new view, and congratulations on your first microsoft/STL pull request (and wow, what a massive effort this was)! 😻 🎉 🚀 This will ship in VS 2022 17.5 Preview 2. |
At long last, the moment we've all been waiting for has come:
std::views::zip
now finally has an implementation for the MSVC STL. This PR builds off of the efforts put forth in #2687. The following defect reports (DRs) and revisions have also been implemented, as described in #2252:std::views::zip
portion of P2165R4.A fallback mechanism is provided which continues to usestd::pair
as described in P2321R2 unless__cpp_lib_tuple_like
is defined.The following features have not been implemented as part of this PR:
std::views::zip_transform
, which this PR does not implement.To re-iterate, the providedstd::views::zip
implementation is compatible with both pre-P2165R4 and post-P2165R4 codebases.The C++ working draft and the reference implementations from the proposed wording found in the aforementioned papers were the only references used in developing this implementation. Future work includes implementing the remaining portions of P2321R2, as well as those of P2165R4. I might be able to contribute more work towards implementing the remaining portions of P2321R2, but for now, only
std::views::zip
is provided.Please let me know if you have any questions.