Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-11 17:49:31


Walter Landry <wlandry_at_[hidden]> writes:

> David Abrahams <dave_at_[hidden]> wrote:
>> Walter Landry <wlandry_at_[hidden]> writes:
>>
>> > The first downside I can think of is that it can make code a little
>> > longer, though not always.
>>
>> It's greedily-evaluated; that's one problem.
>
> Do you mean
>
> Walter Landry <wlandry_at_[hidden]> wrote:
>> The second downside is that it can be very inefficient to actually
>> create a list if not all of the elements are used, especially if there
>> are a lot of files.
>
> That is why I suggested that it be provided, not that it be the only
> interface.
>
> David Abrahams <dave_at_[hidden]> wrote:
>> If you want to be able to call begin() on something, you can just
>> wrap directory_iterator in another object:
>
> I can't run std::sort() on those iterators.

  std::vector<path> v;
  std::copy(directory_iterator(p), directory_iterator(), back_inserter(v));
  std::sort(v.begin(), v.end());

This doesn't seem very inconvenient to me.

> Regards,
> Walter Landry
> wlandry_at_[hidden]
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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