filesystem-proposal icon indicating copy to clipboard operation
filesystem-proposal copied to clipboard

Range support for directory_iterator and recursive_directory_iterator

Open Beman opened this issue 12 years ago • 0 comments

Description

Daniel Krügler [c++std-filesystem-29]

IMO the range-support for [recursive_]directory_iterator should be deferred. The presented technique is IMO an unfortunate "hack" and should be replaced by factory functions returning a std::range<[recursive_]directory_iterator>.

The std::range is IMO the much better solution for this and idiomatic.

Yes, we have not yet std::range, but we nearly got that via a last-minute proposal for C++11. I hope, this time we have a bit more time to make a full-fledged proposal.

I would strongly recommend to defer the range-support instead. We can work with these iterators, they are not broken, several existing iterators provide no direct support for the range-for-loop. It is not a shame that [recursive_]directory_iterator would not at the initial proposal.

Adding a "cleaner" way via factory functions returning a std::range<[recursive_]directory_iterator> can be easily down slightly later.

Discussion

[Beman] I believe the Filesystem library should become a Technical Specification, and as such should rely only on C++11 features.

Deciding if the target is a TS or is C++1y needs to be deferred to a committee meeting so that input from the LWG (and possibly the EWG) is available. Thus an issue is being opened so Daniel's proposal isn't forgotten.

Beman avatar Aug 29 '12 12:08 Beman