Skip to content
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

LWG-3850: views::as_const on empty_view<T> should return empty_view<const T> #3423

Merged
merged 4 commits into from
Feb 14, 2023

Conversation

JMazurkiewicz
Copy link
Contributor

Closes #3418.

@JMazurkiewicz JMazurkiewicz requested a review from a team as a code owner February 12, 2023 01:20
@CaseyCarter CaseyCarter added LWG Library Working Group issue ranges C++20/23 ranges labels Feb 12, 2023
stl/inc/ranges Outdated Show resolved Hide resolved
@@ -303,13 +340,16 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
{
const same_as<iterator_t<R>> auto i = r.begin();
if (!is_empty) {
// (static analyzer doesn't realize that `i == nullptr` implies `is_empty`)
#pragma warning(suppress : 6011) // Dereferencing NULL pointer 'i'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change requested: We avoid suppress in stl/inc (as it sometimes has issues with templates and/or modules, whereas push/disable/pop is reliable) but it's fine in stl/src and test code.

Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was concerned about empty_view<int&> being wrong, but it turns out that empty_view<reference-type> is invalid.

@StephanTLavavej StephanTLavavej self-assigned this Feb 13, 2023
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit f8dd9d1 into microsoft:main Feb 14, 2023
@StephanTLavavej
Copy link
Member

Thanks for helping the list of remaining LWG issues get closer to empty! 😹 📉 🎉

@JMazurkiewicz JMazurkiewicz deleted the lwg3850 branch February 14, 2023 00:59
JMazurkiewicz added a commit to JMazurkiewicz/STL that referenced this pull request Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LWG Library Working Group issue ranges C++20/23 ranges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LWG-3850 views::as_const on empty_view<T> should return empty_view<const T>
4 participants
  翻译: