Boost logo

Boost :

From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2003-11-11 17:10:33


David Abrahams wrote:
> Walter Landry <wlandry_at_[hidden]> writes:
>
[snip]
>>
>> 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());

or even shorter:
    std::vector<path> v(directory_iterator(p), directory_iterator());
    std::sort(v.begin(), v.end());

>
> This doesn't seem very inconvenient to me.
>
Agreed!

nitpickingly :)
//Fredrik


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