Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2003-04-20 21:37:59

Beman Dawes wrote:
> At 02:17 PM 4/20/2003, Edward Diener wrote:
> >Beman Dawes wrote:
> >> At 08:22 AM 4/9/2003, Christian Engström wrote:
> >>
> >> >In my application I need to handle paths that contain wildcards,
> >> such as >for example "foo/chapter?.txt" or "bar/*/index.html".
> >>
> >> I think that your need is both valid and commonplace, but that the
> >> way to handle it isn't necessarily to modify the filesystem
> library. >>
> >> Rather, think about using a filter iterator. See
> >>
> >>
> >> There are a couple of caveats: (1) I haven't actually tried it, so
> >> don't
> >> know if it is a practical solution, and (2) Dave, Jeremy, and
> Thomas >> are working on a major update to iterator adaptors so
> details may >> change once they are done.
> >
> >What good is a filter iterator adaptor supposed to accomplish in
> this >situation ?
> The idea is that rather than directory iteration returning iterators
> for
> all path entries, it would only return those which passed a predicate
> which was driven by the pattern. For some uses, the pattern might
> more flexibly
> be a regular expression rather than the traditional (but non-portable)
> wildcard patterns provided by various operating systems.

Yes, that would work but would consume extra time when done from the
end-users point of view rather than the implementors. First one has the
usual directory iterator returning all files, then one filters it for the
files one wants. At the native API level, admittedly non-portable, functions
already exist to filter the entries based on wildcard patterns as the OS
searches the disk directory.

Finally trying to filter an already existing file list can be far more
difficult than letting the OS use its built-in heuristics and understanding
of wildcards to automatically do it for you. Don't get me wrong, iterator
adaptors are great and the filter adaptor is a great example of using it,
but in this case it is probably not what an end-user wants.

Boost list run by bdawes at, gregod at, cpdaniel at, john at