|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-09-15 15:40:14
At 03:05 AM 9/15/2002, Thomas Witt wrote:
>> Why not just make directory_iterator a typedef for an iterator_adaptor?
>> Does it need additional interface beyond that of a standard iterator?
>
>In a way, yes. As I tried to explain in my previous posting it needs a
ctor
>that takes a path. For most of the stdlib iterators ctors aren't really
an
>issue, as the container classes act as iterator factories. This is
>different for directory_iterator. So we have to provide the iterator
>interface _and_ customized ctors. Thats why I said iterator_adaptor is
>not really well suited.
>
>With iterator_adaptor only a ctor taken the base_type is provided. As I
>tried to show in my code example there is a way to use iterator_adaptor
>and have the desired ctor, but I consider this solution a hack. In order
>to have the desired ctor(directory_iterator(path const&)) I have made
path
>the base type.
Your solution is clever, but I agree it is a hack.
The best solution seems at this point to just write directory_iterator
implementation by hand.
The same problem affects the experimental recursive_directory_iterator.
Note that unless I'm missing something, these are pure implementation
issues and don't affect the public Filesystem Library interface at all.
Thanks for all the suggestions and other help,
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk