Boost logo

Boost :

Subject: Re: [boost] [filesystem] C++11 range-based for statement and BOOST_FOREACH support
From: Beman Dawes (bdawes_at_[hidden])
Date: 2012-07-20 15:33:37


On Sun, Jul 15, 2012 at 9:22 AM, Jeff Flinn <Jeffrey.Flinn_at_[hidden]> wrote:
> 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:-))

Let's wait a bit to see what the committee's Filesystem study group
thinks. If they want the non-member being/end approach for the
standard, that would still leave directory_range as something that
could be added to Boost.Range.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk