|
Boost : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2004-09-27 16:10:44
> Don't get me wrong, I'm not disagreeing. It's just that I'm on a steep
> learning curve here.
>
> Maybe it helps us both if I present some code. The first thing that
> boost::glob does is parse the "../foo*bar/*.cpp" pattern into a list of
> predicates, one per component in the pattern tree (3 in this case):
>
[...]
>
> Now, presumably you're going to come back at me and tell me that this is
> all just implementation detail. That's true, it is. But my problem is that
> I don't yet see how I could attack the problem more efficiently using some
> other approach.
>
> Does any of this make sense?
>
> Regards,
> Angus
You need to implement iterator that match InputIterator concept. Also it is
very similar to iteration though N-ary matrix.
You need to build a collection of directory iterators on each level.
Here is a sketch of how next function would look like (if you use
input_iterator_adaptor).
void next()
{
starting from end find first level iterator that is not equal to end
If not found, finite la comedi.
if found last level, increment it and that's all
If found level in the middle increment it, rebuild all directory
iterators for following levels and start from the beginning.
}
I think there should be iterator like this (generic, over matrix)
somewhere.If not it would be interesting undertaking.
Regards,
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk