
On 7/13/2012 8:01 AM, Andrey Semashev wrote:
On Friday 13 July 2012 07:55:13 Beman Dawes wrote:
I don't see any abuse of begin() and end(). They were put in the core language's list of ways to enable range-base for so that there would be no need to add the complication of a separate class plus a make_x_range function to handle cases like this. Unless I'm missing something, adding wrappers the user must use increases complexity and reduces teachability without adding additional functionality. The beauty of begin/end free functions is that the user doesn't even have to know they exist - range-based for "just works".
The user has to know that directory_iterator is special and can be used as a range. This doesn't simplify teaching. At least, not for me.
+1 I too would like to see a directory_range(const path&). Not just for use with BOOST_FOR_EACH, but primarily for use with boost range. Whether this belongs in filesystem or in range is an open question. (to me at least:-)) Jeff