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

Implement LWG-3480, directory_iterator and recursive_directory_iterator are ranges #2340

Merged
merged 5 commits into from
Dec 9, 2021

Conversation

fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Nov 16, 2021

Fixes #2315

@fsb4000 fsb4000 requested a review from a team as a code owner November 16, 2021 14:16
@CaseyCarter CaseyCarter added LWG Library Working Group issue ranges C++20/23 ranges labels Nov 16, 2021
inline constexpr bool enable_view<filesystem::recursive_directory_iterator> = true;
} // namespace ranges
#endif // __cpp_lib_concepts

Copy link
Member

Choose a reason for hiding this comment

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

Hint to other reviewers: our end overloads for directory_iterator and recursive_directory_iterator already take their argument by value as in the proposed resolution of LWG-3480. In fact they always have, all the way back to MSVC-PR-108103! I'll have to thank Gor for realizing that WG21 would want to change these 3.5 years later =)

[No change requested.]

@CaseyCarter CaseyCarter added the defect report Applied retroactively label Nov 16, 2021
inline constexpr bool enable_view<filesystem::recursive_directory_iterator> = true;
} // namespace ranges
#endif // __cpp_lib_concepts

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, noting for the record: These explicit specializations work because the primary templates are defined in <xutility>:

STL/stl/inc/xutility

Lines 1972 to 1973 in 3c2fd04

template <class>
inline constexpr bool enable_borrowed_range = false;

STL/stl/inc/xutility

Lines 2696 to 2698 in 3c2fd04

template <class _Ty>
inline constexpr bool enable_view =
derived_from<_Ty, view_base> || _Derived_from_specialization_of<_Ty, view_interface>;

@StephanTLavavej StephanTLavavej self-assigned this Dec 8, 2021
@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 306b4e4 into microsoft:main Dec 9, 2021
@StephanTLavavej
Copy link
Member

Thanks for range-ifying these iterators and getting the codebase closer to zero LWG issues! 😸 🚀 🎉

@fsb4000 fsb4000 deleted the fix2315 branch December 9, 2021 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect report Applied retroactively LWG Library Working Group issue ranges C++20/23 ranges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LWG-3480 directory_iterator and recursive_directory_iterator are not C++20 ranges
3 participants
  翻译: